in reply to [untitled node, ID 192588]
eval can take either a block of code to trap runtime errors or a string to parse and sometimes execute at runtime. You're attempting to do the latter, but rather than pass a string as an argument you're passing a filehandle (<update>without the line delimiter implicitly undefined as in valdez's example</update>).
ehdonhon and sauoq's approaches are better if all you've got is Perl in those files, but this'll work too:
which places all the text in your file into a single string and eval's it.my $code; open FILE, "/home/samn/cgi-bin/$page.rs" or die 'Monkeys!'; while (<FILE>) { $code .= $_; } eval $code;
|
|---|