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 ...
This may be of interest as well: Perl Idioms Explained - my $string = do { local $/; <FILEHANDLE> };
Also be sure to read through all off the perlvar section on $/ -- i think you're looking for local $/ = "";sub slurpie { local $/ ; return <DATA>; # contains whole thing } sub DATA_w_line_numbers { while (<DATA>) { print "$.) $_"; } }
This may be of interest as well: Perl Idioms Explained - my $string = do { local $/; <FILEHANDLE> };
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: $/ question
by convenientstore (Pilgrim) on Jan 13, 2008 at 03:13 UTC | |
by convenientstore (Pilgrim) on Jan 13, 2008 at 03:40 UTC | |
by kyle (Abbot) on Jan 13, 2008 at 03:47 UTC | |
by convenientstore (Pilgrim) on Jan 13, 2008 at 03:55 UTC | |
by kyle (Abbot) on Jan 13, 2008 at 04:13 UTC | |
|
In Section
Seekers of Perl Wisdom