Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: readline() on unopened filehandle

by NetWallah (Abbot)
on Sep 09, 2012 at 14:11 UTC ( #992587=note: print w/ replies, xml ) Need Help??


in reply to readline() on unopened filehandle

Since you are just a few months into perl, here is the canonical way to do this (Note - I changed the name and meaning of your variable for clarity):

my $pfaminput_filename ='D:/ARP/Downloads/Trembl/toxinpospf.txt'; # Double fwd-slash is not necessary open (my $pfaminput_filehandle , "<" , $pfaminput_filename ) or die "Can't open '$pfaminput_filename' : Error is : $!"; while (my $pfam = <$pfaminput_filehandle>){ print $pfam; } close $pfaminput_filehandle;
Update: Corrected variable name inside error message.

             I hope life isn't a big joke, because I don't get it.
                   -SNL


Comment on Re: readline() on unopened filehandle
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2015-07-04 06:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls