in reply to how to split
Note that the whole thing is in curly brackets so that our value for $/ gets restored for any subsequent code (really, look up the slurp idiom.)
use strict; use warnings; use Data::Dumper; my (@header, @lin); { open FILE, "/home/guest/align.txt" or die("Error reading file: $!"); local $/ = '>'; while (my $result_set = <FILE>) { $result_set =~ s/>$//; # trim trailing EOL marker if ($result_set =~ m/^(.*?)(Query:.*)$/s) { push @header, $1; push @lin, $2; } } }; print Dumper(\@header); print Dumper(\@lin);
|
|---|