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