in reply to Re: Counting the number of items returned by split without using a named array
in thread Counting the number of items returned by split without using a named array

Ha, great
print $count = $_ =~ s/\S+//g;

was probably what I wanted - just didnt know you could do that with a simple search (although I wondered if one couldnt just use a search in some way)

Thx a lot

Why does a simple
print $count = s/\S+//g;

not work, though?

This (as suggested below) did not count anything either:

$count = () = s/\S+//g;

I.

Replies are listed 'Best First'.
Re^3: Counting the number of items returned by split without using a named array
by borisz (Canon) on May 03, 2006 at 13:02 UTC
    I use m//g bellow __not__ s///g.
    Boris
Re^3: Counting the number of items returned by split without using a named array
by blazar (Canon) on May 03, 2006 at 13:11 UTC

    Although this may occasionally work for you in this circumstance, it's not logical to modify the original string just to count the number of occurrences. Just use /\S+/g instead.