Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Compare hash with arrays and print

by toolic (Bishop)
on Jul 12, 2010 at 18:34 UTC ( [id://849074]=note: print w/replies, xml ) Need Help??


in reply to Compare hash with arrays and print

Can you clarify what problem you are having?

If the problem is that your 3 output files are empty, then you need to print something to them. The only print I see in your code has been commented out.

Replies are listed 'Best First'.
Re^2: Compare hash with arrays and print
by ad23 (Acolyte) on Jul 12, 2010 at 19:01 UTC

    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!

      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://849074]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2025-12-08 19:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (88 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.