Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: valid filehandle

by DaveH (Monk)
on Mar 20, 2003 at 23:49 UTC ( [id://244768] : note . print w/replies, xml ) Need Help??


in reply to valid filehandle

Hi.

I'd use some variation of IO::File or IO::Handle. e.g.

use IO::File; my $fh = IO::File->new("<test.txt"); if (!$fh) { #do something print "my file didn't open\n"; } else { #use $test to print something print "my file did open\n"; while (<$fh>) { # ... } }

I hope that helps.

Cheers,

-- Dave :-)


$q=[split+qr,,,q,~swmi,.$,],+s.$.Em~w^,,.,s,.,$&&$$q[pos],eg,print