my $line = \"file1.gz file2.gz file3.gz\";
my @abc = split(\'\', $line);
print \"@abc\\n\";
Expected output:
file1.gz
file2.gz
file3.gz
I found this one to be very simple!
my $line = "file1.gz file2.gz file3.gz";
my @abc = ($line =~ /(\w+[.]\w+)/g);
print $abc[0],"\n";
print $abc[1],"\n";
print $abc[2],"\n";
output:
file1.gz
file2.gz
file3.gz
Here take a look at this tutorial to find more on Perl regular expression and scroll down to More matching section.