To add an eval to catch the error you are getting would look like:
but I'd do it differently. I'd check for the empty file separately so that a malformed file still generates an error that you can diagnose. - tye (but my friends call me "Tye")open DATA, "<$datafile" or die "$!"; { local $/; eval { %somehash = %{ eval <DATA> }; }; }
In reply to (tye)Re: Data::Dumper and eval
by tye
in thread Data::Dumper and eval
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |