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.
Recent Comments
- Charles
- jpmcfarlane
- Kiffin
- jpmcfarlane
- KathleenC