my $contents = do { local(@ARGV, $/) = $file; <> };
Also check out answers/discussions on SO, such as this one.
In reply to Re: How do I read an entire file into a string?
by reisinge
in thread How do I read an entire file into a string?
by vroom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |