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

whoah , i didn't know it worked. print doesn't seem to work if i don't use my split functions enclosed in a bracket. But thanks :)
  • Comment on Re: how to split a string and take certain position?

Replies are listed 'Best First'.
Re^2: how to split a string and take certain position?
by erroneousBollock (Curate) on Sep 24, 2007 at 04:34 UTC
    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

      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];