Oops. You've just left $/ set to undef for the rest of the program. This can lead to all sorts of nastiness.
Better to do something like this:
my $file_text; { local $/; $file_text = <FILE>; } print $file_text;
Which returns $/ to its original value once you leave the bare block.
Update: I should point out that my correction was to the original version of this node. It's now been changed to use my suggestion.
--
"Perl makes the fun jobs fun
and the boring jobs bearable" - me
In reply to Re: Slurp a file
by davorg
in thread Slurp a file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |