in reply to Perl Idioms Explained - my $count = () = /.../g
Just to have it mentioned: another way to do it is given in perldoc -f scalar:
Personally, I think this makes the meaning clearer, but I'm sure others may disagree.#!perl -l my $str = "here are some words"; my $count = @{[ $str =~ /\S+/g ]}; print $count;
In Section
Meditations