[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] split oddity



Chris Nandor writes:
|At 14.48 -0500 1999.03.07, Brian L. Matthews wrote:
|>#!perl
|>$x = 'a,b,c,d,e,f';
|>($a, undef, undef, $d, $e) = split /,/, $x;
|>print "$a-$d-$e\n";
|Confirm problem here.  Note that this works for me:
|#!perl
|$x = 'a,b,c,d,e,f';
|($a, undef, undef, $d, $e, $f, $g) = split /,/, $x;
|print "$a-$d-$e\n";

Yes, I'd expect that to work. split is clearly not counting the undefs
when calculating it's implicit limit, so adding the extra elements
increases the count enough so split uses the "correct" limit.

($a, $d, $d, $d, $e) = split /,/, $x;

also works, as now there are no undefs for split to miscount.

|MacPerl is at 5.004, not 5.004_04.

Ah, I somehow thought MacPerl was 5.004_04. This undoubtedly explains it.
Sorry for the bother.

Brian

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org