On Oct 28, 2005, at 16:16, JupiterHost.Net wrote:
Hello,
My question is, why can't I slurp in the entire file?
Because you're fiddling with things that ought not be fiddled
with ;p (IE $\)
instead:
use File::Slurp;
my @lines = read_file($file);
Wrong, that code assumes $file has the runtime platform conventions,
which is not the case.
You'll end up with the entire file as a single string in @lines, not
the expected array of lines. The reason is that \015 is the line
separator in the file. Hence, seen as a text file in a Linux box it
has only one line.
To make it work with File::Slurp that way we need to do precisely
what you said we ought not to: fiddle with $/ before the call to
read_file().
-- fxn
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>