I don't know if your way is "standard" or not, but I've done it like so on occasion:
(when I've just wanted the program to die with an appropriate error when it can't open the file)my $content = do { local(@ARGV,$/) = $filename; <> };
Anyway, why go through all the trouble of reading line by line and joining all of the lines together when you can just read the entire file into a scalar without all of the extra processing?
In reply to Re: slurp mode
by duff
in thread slurp mode
by szabgab
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |