I decided to run this test script under various versions of Perl.
@examples = split /\n/, <<'EXAMPLES';
sin / ...
time / ...
localtime / ...
caller / ...
eof / ...
use constant FOO => 35; FOO / ...
use Fcntl qw(LOCK_SH); LOCK_SH / ...
sub no_args (); sub no_args{1}; no_args / ...
sub one_arg ($); sub one_arg{1}; one_arg / ...
sub normal (@); sub normal{1}; normal / ...
EXAMPLES
for (@examples) {
s=\.\.\.=25 ; # / ; die "this dies!";=;
local($a) = eval;
$a = $@ if $@;
print "$_\n\t$a\n";
}
I don't know what the results would be for earlier versions, but from Perl 5.6 onwards it's pretty consistent.
| Example | 5.006 | 5.008 | 5.010 |
| sin | dies | dies | dies |
| time | 49274891.72 | 49274891.74 | 49274891.76 |
| localtime | dies | dies | dies |
| caller | dies | dies | dies |
| eof | dies | dies | dies |
| FOO | 1.4 | 1.4 | 1.4 |
| LOCK_SH | dies | dies | 0.04 |
| no_args | dies | dies | dies |
| one_arg | dies | dies | dies |
| normal | dies | dies | dies |
Most of the "dies" instances also produced this message:
Warning: Use of "XXX" without parentheses is ambiguous at (eval N) line 1.
However, the LOCK_SH example never generated errors, while the last three generated "Prototype mismatch" messages.
I must also note that almost all of the examples generated warnings, despite
using neither the '-w' option or 'use strict;'