http://www.perlmonks.org?node_id=292107


in reply to Re: Perl Idioms Explained - @ary = $str =~ m/(stuff)/g
in thread Perl Idioms Explained - @ary = $str =~ m/(stuff)/g

Hmm it is of course as you say. I must have got myself confused with the behaviour of s///.

$data = 'stuff stuff stuff'; $num = $data =~ s/(stuff)//g; print $num, $/; __DATA__ 3

You can force it to do as I said by cheating thusly....

$num = () = 'stuff stuff stuff' =~ m/(stuff)/g; print $num; __DATA__ 3

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print