in reply to Idiomatic Split to Scalar Conversion
If you are just counting you could do: my $foo = $bar =~ tr/,/,/ + 1; To stick with split you could do this:
my $foo = my @a = split /,/, $bar; # Or this $foo++ for split /,/, $bar; # But why doesn't this work? my $foo = () = split /,/, $bar;
--
John.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Idiomatic Split to Scalar Conversion
by sfink (Deacon) on Apr 30, 2002 at 00:11 UTC | |
by particle (Vicar) on Apr 30, 2002 at 04:29 UTC |