in reply to Re: Re: split as immediate array?
in thread split as immediate array?

...works in every instance except when trying to print it immediately.

You're probably running afoul of the function vs. "list operator" nature of builtin's when called with and without parentheses, respectively. Specifically, perl sees that first parenthesis and says to itself, "Oh! That must be a function call," when, really, you want those parentheses to create a list that you can then subscript. So you end up subscripting the return value of print (ie, a list containing a single element: (1)) Try:

print +(split(...))[3]; # force "list operator" mode, or... print( (split(...))[3] ); # make the whole thing a function call.

Update: Elucidated exactly what I meant by "running afoul". :-)

bbfu
Seasons don't fear The Reaper.
Nor do the wind, the sun, and the rain.
We can be like they are.

Replies are listed 'Best First'.
Re: (bbfu) (function vs "operator") Re: Re: Re: split as immediate array?
by Rydor (Scribe) on Aug 11, 2001 at 20:18 UTC
    yeah, i see how those paranthesis mess that up. thanks.

    @:::::::((==========Rydor====>