Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: use of diamond operator for multiple files

by hdb (Prior)
on Apr 24, 2014 at 12:16 UTC ( #1083573=note: print w/replies, xml ) Need Help??

in reply to use of diamond operator for multiple files

Two comments from my side. First, your subroutine does the same thing twice. I would change it such that it reads the filtered contents of a given file into a given array and call it twice. Second, your while loop is essential equivalent to grep, so in summary, I would rewrite your code as:

my @seq1 = load_seqs( "q1.fa" ); my @seq2 = load_seqs( "q2.fa" ); sub load_seqs{ open my $fh, "<", shift or die "cannot open sequence file: $!"; return grep { /^(?!\>).*\n$/ } <$fh>; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1083573]
[choroba]: Perlingo
[Discipulus]: Perl In Go?
[erix]: hm comfortable french cars..
[Discipulus]: congrats choroba!
Discipulus shutdown and logoff seem untrappable by Perl on win. But it is in Cygwin. but i cannot switch to it

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2017-01-17 09:35 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (154 votes). Check out past polls.