Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^6: Line numbers

by Anonymous Monk
on Mar 17, 2012 at 00:39 UTC ( [id://960101]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Line numbers
in thread Line numbers

So you exchange parens for square brackets and add an arrow instead. Sorry, but you really haven't proven your point. They are both non-obvious until you understand how Perl handles precedence and lists. caller(0)[0] fails because you are trying to index a scalar, not a list.

Replies are listed 'Best First'.
Re^7: Line numbers
by LanX (Saint) on Mar 17, 2012 at 01:57 UTC
    > fails because you are trying to index a scalar

    No,it fails because it's undefined syntax

    syntax error ... near ")["

    and indexing a list always requires parens!

    see perldata

    A list value may also be subscripted like a normal array. You must +put the list in parentheses to avoid ambiguity.

    Cheers Rolf

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-04-19 13:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found