title: Split by dot using Perl
body: <p>I use the <a href="https://perldoc.perl.org/functions/split.html" rel="nofollow noreferrer">split</a> function by two ways. First way (string argument to <em>split</em>):</p>
  <pre><code>my $string = &quot;chr1.txt&quot;;
  my @array1 = split(&quot;.&quot;, $string);
  print $array1[0];
  </code></pre>
  <p>I get this error:</p>
  <blockquote>
  <p>Use of uninitialized value in print</p>
  </blockquote>
  <p>When I do split by the second way (regular expression argument to <em>split</em>), I don't get any errors.</p>
  <pre><code>my @array1 = split(/\./, $string); print $array1[0];
  </code></pre>
  <p>My first way of splitting is not working only for dot.</p>
  <p>What is the reason behind this?</p>