in reply to Re: how to split a string and take certain position?
in thread how to split a string and take certain position?

There's a general rule: If it looks like a sub-call, it's a sub-call. :-)

  print (@somelist)[1]

is treated as

  print(@somelist) [1]

which is also a syntax error.

-David

Replies are listed 'Best First'.
Re^3: how to split a string and take certain position?
by ikegami (Patriarch) on Sep 24, 2007 at 04:52 UTC

    Two common solutions is two put parens around the function's arguments

    print( (@somelist)[1] );

    Or put something between the function name and the opening parens, such as the no-op operator

    print +(@somelist)[1];