A regex should be between / / marks ...
The =~ operator is sufficiently DWIMic that it will take any string as a regex. It will even take all the qr// regex modifiers if they are embedded as (?adlupimsx-imsx) extended patterns.
c:\@Work\Perl>perl -wMstrict -le "my $regex = '(?xms) ((.) \2{2,})'; ;; for my $s (qw(aeiou aeeiou aeiiiou aeioooou)) { print qq{match: captured '$1'} if $s =~ $regex; } " match: captured 'iii' match: captured 'oooo'
... but that won't work ...
The first comment I made is actually rather trivial in the face of your second point; the substitution s/\),\(/\)\n\(/ is, indeed, a substitution and not a regex — and bang, the whole endeavor hits a brick wall.
Give a man a fish: <%-{-{-{-<
In reply to Re^2: Regex stored in a scalar
by AnomalousMonk
in thread Regex stored in a scalar
by OtakuGenX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |