You need to check whether open fails and report a useful error. Here is a trick to do that for you:
Though I'm taking on faith that local(*ARGV) will properly save and restore everything that <> manipulates. (: - tye (but my friends call me "Tye")my $contents= do { local(*ARGV,$/); @ARGV="myfile.txt"; <> };
In reply to (tye)Re: Slurp a file
by tye
in thread Slurp a file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |