my $line = \"file1.gz file2.gz file3.gz\"; my @abc = split(\'\', $line); print \"@abc\\n\";
Expected output:
file1.gz file2.gz file3.gz
Just use /\s+/ against '' as a splitter. In this case all "extra" blanks were removed. Usually this particular behaviour is required. So, in you case it will be:
my $line = "file1.gz file1.gz file3.gz"; my @abc = split(/\s+/, $line);