« Intersecting trajectories | Main | Dutch handicap »
August 31, 2005
Simple slurping ~ Perl stuff
This is more than likely the best way to read an entire file into a given variable $code all in one go:
my $code = do { local $/; <$fh> };
Notice that by localizing the input record separator $/ variable within the brackets, unwanted side-effects are avoided.
Of course, if one is more prone to power slurping, then the module Perl6::Slurp offers a much more advanced interface, but one will just have to be patient and wait awhile.

Posted at 10:51 PM
Trackback Pings
TrackBack URL for this entry:
http://www.kiffinsblog.com/cgi-bin/mt/mt-tb.cgi/115
0 Comment(s)
Post a comment
Thanks for signing in, . Now you can comment. (sign out)
(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)







