http://qs321.pair.com?node_id=662140


in reply to $/ question

If you're undef'ing it, then you're in slurp mode, and there's no point in looping, because there's only going to be one line in the file ...
sub slurpie { local $/ ; return <DATA>; # contains whole thing } sub DATA_w_line_numbers { while (<DATA>) { print "$.) $_"; } }
Also be sure to read through all off the perlvar section on $/ -- i think you're looking for local $/ = "";

This may be of interest as well: Perl Idioms Explained - my $string = do { local $/; <FILEHANDLE> };