You can get this without a dummy array assignment with:
my $n = scalar @{[split ',', $str]};
The 'scalar' is optional, but I like it for readability.
In reply to Re: How to get the number of fields found by split without a warning?
by Zed_Lopez
in thread How to get the number of fields found by split without a warning?
by Rudif
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |