use strict; use warnings; use feature 'say'; say "This is perl $^V"; package Input { sub awesome { say "yay, this works"; } } # this works 'Input'->awesome; # the "open" is parsed, but not actually executed eval <<'END'; sub red_herring { open Input, "<&", \*STDIN or die $!; } END say "eval failed: $@" if $@; # this will die eval { 'Input'->awesome; }; say "Caught: $@" if $@; #### This is perl v5.16.2 yay, this works Caught: Can't locate object method "awesome" via package "IO::File" at prog.pl line 27.