Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Empowered by Perl

by halley (Prior)
on Oct 15, 2007 at 19:42 UTC ( [id://645015]=note: print w/replies, xml ) Need Help??


in reply to Re: Empowered by Perl
in thread Empowered by Perl

Doesn't seem pretty, but you don't have to deal with closing or colliding with the filehandle...
my @contents = do { open(my $fh, "/my/text/file") or die; <$fh> };
tye recommended something like this, some time ago.
my @contents = do { local *ARGV; @ARGV=('/my/text/file'); <> };
His also supports concatenation of multiple files, just add them in the parentheses.

--
[ e d @ h a l l e y . c c ]

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2024-03-28 08:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found