I keep getting "readline() on unopened filehandle DATA at (eval 1) line 5." when evaling a script with a __DATA__ section. Would you have any pointers to fix?
Thanks!
#!/usr/bin/perl use strict; use warnings; open(F, "test.pl"); my $f = do { local $/; <F> }; close(F); eval ($f); Test.pl: #!/usr/bin/perl use strict; use warnings; while (<DATA>) { chomp; print "TEST: *$_*\n"; } close DATA; __DATA__ TEST 1 2 3
In reply to Losing __DATA__ when evaling script. by yoda54
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |