![]() |
|
Your skill will accomplish what the force of many cannot |
|
PerlMonks |
RE: Return the contents of a fileby chromatic (Archbishop) |
on Apr 12, 2000 at 18:43 UTC ( #7383=note: print w/replies, xml ) | Need Help?? |
You can also redefine the input record separator $/ to a null string:
That obviates the need for a while loop. Normally, $/ is set to a newline. That's why the magic <FILEHANDLE> reads one line at a time. Using a local $/ will change that to whatever separator you want. Specify none, slurp the whole thing. That could make your first example even more compact.
In Section
Snippets Section
|
|