in reply to How do I read an entire file into a variable?
$/=undef; #sets the record separator to [undef] so i +t keeps reading #until there is nothing more to read open FILE, "<yourfile"; my $data=<FILE>; close FILE; $/="\n"; #set it back to \n so if you try to read f +rom the #terminal it only takes a line at a time
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: How do I read an entire file into a variable?
by Kasei (Novice) on Dec 29, 1999 at 06:08 UTC | |
by vroom (His Eminence) on Dec 29, 1999 at 09:25 UTC |