Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Eight years later...

by samwyse (Scribe)
on Jan 13, 2009 at 19:08 UTC ( #736045=note: print w/ replies, xml ) Need Help??


in reply to On Parsing Perl

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.
Example5.0065.0085.010
sindiesdiesdies
time49274891.7249274891.7449274891.76
localtimediesdiesdies
callerdiesdiesdies
eofdiesdiesdies
FOO1.41.41.4
LOCK_SHdiesdies0.04
no_argsdiesdiesdies
one_argdiesdiesdies
normaldiesdiesdies
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;'


Comment on Eight years later...
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://736045]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2014-07-13 11:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (249 votes), past polls