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;'
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|