Split by dot using Perl
perl, split
Solution
`"\."` is just `.`, careful with escape sequences.
If you want a backslash and a dot in a double-quoted string, you need `"\\."`. Or use single quotes: `'\.'`
Problem
I use the split function by two ways. First way (string argument to split): ``` my $string = "chr1.txt"; my @array1 = split(".", $string); print $array1[0]; ``` I get this error: Use of uninitialized value in print When I do split by the second way (regular expression argument to split), I don't get any errors. ``` my @array1 = split(/\./, $string); print $array1[0]; ``` My first way of splitting is not working only for dot. What is the reason behind this?