Re: why warn on undefined $1?



On Aug 29, 7:33 pm, Gunnar Hjalmarsson <nore...@xxxxxxxxx> wrote:
i...@xxxxxxxxxxx wrote:
how can I store the s/// regexp in a variable? I want
something like qr//, but for s///. In other words, I want this to
work, but it doesn't.

my $re = s/or(ed|ing|s)?$/our$1/;

my $re = 's/or(ed|ing|s)?$/our$1/';

my $s = 'colored';
$s =~ $re;

eval "\$s =~ $re";

print $s;
# coloured

Awesome. Is there any way to precompile the $re, as qr// would do?

.