The /g variants are for repetitive matches / looping !
It's comparable to switching between if and while , which are obviously different beasts.
If you look at other languages like eg javascript¹ you'll notice that they are implemented using different keywords.
( I wished the perldocs were clearer here because it's causing confusion)
Furthermore are regular expressions meant to be combinable/nestable , but a sub expression with /g doesn't make any sense.
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
¹) couldn't reproduce this easily, JS is very close to Perl in many aspects,
I had probably another language in mind... Python, PHP?
In reply to Re: 'g' flag with 'qr' (different commands) (updated)
by LanX
in thread 'g' flag w/'qr'
by perl-diddler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |