... keep the regex as a string ... has some disavantages ...
Not least of which is that a Regexp object interpolates into another regex as an independent, quantifiable non-capturing group, and an interpolated string does not:
The two different representations can have very different effects when interpolated into a larger regex.c:\@Work\Perl\monks>perl -wMstrict -le "my $rs = 'abc|xyz'; my $rx = qr(abc|xyz); ;; my $regex = qr( $rs+ $rx+ )x; print $regex; " (?x-ism: abc|xyz+ (?-xism:abc|xyz)+ )
Give a man a fish: <%-{-{-{-<
In reply to Re^2: Why does /i not seem to work
by AnomalousMonk
in thread Why does /i not seem to work
by perlpipe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |