in reply to RE: How do I read an entire file into a variable?
in thread How do I read an entire file into a variable?

Probably better to use local() and a block so as not to cause problems if somebody else set $/ to something other than \n (assumptions can come back to haunt you) .
my $data; { local($/) = undef; open (FILE, "<yourfile"); $data = <FILE>; close FILE; }

Replies are listed 'Best First'.
RE: RE: RE: How do I read an entire file into a variable?
by vroom (His Eminence) on Dec 29, 1999 at 09:25 UTC
    Good point... although I think now that I see nate's method I think that will be my method of choice in the future.