Beefy Boxes and Bandwidth Generously Provided by pair Networks Ovid
"be consistent"
 
PerlMonks  

Re^2: strings->can->isa but numbers->can't?

by Anonymous Monk
on Apr 26, 2012 at 18:13 UTC ( #967428=note: print w/ replies, xml ) Need Help??


in reply to Re: strings->can->isa but numbers->can't?
in thread strings->can->isa but numbers->can't?

Elsewhere, Perl will stringify when it wants a string. There's no good explanation as to why it doesn't do that here.

Sure there is, 3 is not a valid package or subroutine, name

$ perl -le " package 3; " syntax error at -e line 1, near "package 3;" Execution of -e aborted due to compilation errors. $ perl -le " $3::3 " Bareword found where operator expected at -e line 1, near "$3::3" (Missing operator before ::3?) syntax error at -e line 1, near "$3::3 " Execution of -e aborted due to compilation errors. $ perl -le " sub 3 { 3 } " Illegal declaration of anonymous subroutine at -e line 1.


Comment on Re^2: strings->can->isa but numbers->can't?
Download Code
Re^3: strings->can->isa but numbers->can't?
by choroba (Prior) on Apr 26, 2012 at 22:04 UTC
    But, interestingly
    perl -le "*3 = sub { 4 };print 3->()" 4

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2013-05-20 00:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best material for plates (tableware) is:









    Results (399 votes), past polls