my @words; my $len; while () { $len += @words = split /\s+|[,:]/; } print "LEN = $len\n";