in reply to Counting the number of items returned by split without using a named array
Why not just count the instances of whitespace?
my $str = "this is a test string"; my $cnt = 1; # num tokens = whitespace + 1 ++$cnt while $str =~ /\s+/g; print $cnt, "\n"; # prints 5
-- Tanalis
#include www.liquidfusion.org.uk
In Section
Seekers of Perl Wisdom