Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Compare hash with arrays and print

by ad23 (Acolyte)
on Jul 12, 2010 at 19:01 UTC ( [id://849079]=note: print w/replies, xml ) Need Help??


in reply to Re: Compare hash with arrays and print
in thread Compare hash with arrays and print

Doesn't select command selects the file and print the contents?

I used it as below in my code before:

my $in = $ARGV[0]; my $x = $ARGV[1]; my $y = $ARGV[2]; open IN , "<$in" or die $!; open X, ">$x" or die $!; open Y, ">$y" or die $!; while (<IN>) { if (/^>/) { if (/infor_present:/) { select X; } else{ select Y; } } print; }

In the above code, there is a "print" statement after it comes out of loop. So in order to print the contents in multiple files, how can we use print in this manner?

Also, I tried making a hash for the Sample.fa files with header as key and seq as values. But since I am reading multiple files, that approach is not working (as I run out of memory!). Kindly help.

Thanks!

Replies are listed 'Best First'.
Re^3: Compare hash with arrays and print
by toolic (Bishop) on Jul 12, 2010 at 19:26 UTC
    Doesn't select command selects the file and print the contents?
    No, select alone will not print to a file. You must also use print, as you have done in your new code example.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://849079]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2025-12-14 22:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (95 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.