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'
In reply to Re^2: Regex question
by AnomalousMonk
in thread Regex question
by DoubleBond
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |