in reply to use of diamond operator for multiple files
If I understand correctly, you want a separate array to be created for each input file. The following code creates a hash of array references, with the key being the file name and the value a reference to an array containing all the lines that do not begin with '>':
my %results; { local @ARGV = ( 'q1.fa', 'q2.fa' ); /^>/ or push @{ $results{ $ARGV } }, $_ while <>; }
To access (ie print) this HoA, you could do, for example:
for ( keys %results ) { print "$_:\n"; print @{ $results{ $_ } }; print "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: use of diamond operator for multiple files
by aeqr (Novice) on Apr 23, 2014 at 21:07 UTC |