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

Re: [MacPerl] split oddity



Brian L. Matthews wrote:
> 
> Consider:
> 
> #!perl
> $x = 'a,b,c,d,e,f';
> ($a, undef, undef, $d, $e) = split /,/, $x;
> print "$a-$d-$e\n";
> 
> What would you expect this to print? I expected:
> 
> a-d-e
> 
> and under perl5.004_04 on my ISP, that's what I get. However, under MacPerl
> 5.2.0r4, which I *thought* was 5.004_04, I get:
> 
> a-d,e,f-
> 
> Comments, confirmations?
> 

It looks like the split is counting three elements in the list
($a, undef, undef, $d, $e) and splitting the string into four pieces.

($a)    = 'a';
(undef) = 'b';
(undef) = 'c';
($d)    = 'd,e,f';
($e)    = undef;


I'd say it's a bug.


MacPerl 5.2.0r4 appears to be based on 5.004, not 5.004_04.  :/


Ronald
 

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