in reply to Re: Regex question
in thread Regex question

Conversely, if the  /g modifier is used when matching in list context, regex behavior is changed yet again:

c:\@Work\Perl>perl -wMstrict -le "my $line = 'Happy Birthday'; ;; my $p; ($p) = $line =~ /(Happy).*/; print qq{A: '$p'}; ;; ($p) = $line =~/Happy/g; print qq{B: '$p'}; " A: 'Happy' B: 'Happy'