use warnings;
use strict;
use 5.0100;
eval {
print 10/0; # equivalent to: die "Illegal division by zero";
};
if($@) {
if($@ =~ /Illegal division by zero/) {
print "I feel funny\n";
exit;
} else {
die $@;
}
}
# No exception thrown.
print "What do you know, Perl can divide by zero.\n";
When the code is placed in a file, a proper insufficient version abend happens.
I'm not sure why exactly this is, but it is obviously some sort of issue with use version; not being processed as one might expect when the code source is standard input. I'm not sure in general how important that is to have fixed, since it is kind of a degenerate case. It'd be useful for example snippets, though, if pasting into the standard input stream worked the same way as writing to a file and calling perl with that file as an argument. |