http://qs321.pair.com?node_id=528530


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:
#!perl -l my $str = "here are some words"; my $count = @{[ $str =~ /\S+/g ]}; print $count;
Personally, I think this makes the meaning clearer, but I'm sure others may disagree.