in reply to Re: Perl newbie question.
in thread Perl newbie question.

my $nr = split (/\s+/, $_[0]);

We can get the number of elements by simply assigning the return value of split into a scalar variable.

Example
$str="1:3:4:5"; my $num=split(':',$str); print "Num:$num";

$num will contain '4'.