On Fri, Jul 9, 2010 at 09:22, Chas. Owens <chas.ow...@gmail.com> wrote:
snip
> {
>    my @temp = split /\n/, "first\nsecond\nthird";
>    xpto @temp;
> }
snip

Or you use the [CountOf secret operator][1] to count the number of
items split returns, but not well the use of a -1 limit on the split.
If you don't provide a negative limit, then split will optimize itself
for returning to an empty list and the result will be 1 regardless of
the input (well, an empty string will still return 0).

xpto( ()= split /\n/, "first\nsecond\nthird", -1 );

 [1]: http://cowens.github.com/perlopquick/perlopquick.html#()=-X

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to