Re: why warn on undefined $1?
- From: "ihok@xxxxxxxxxxx" <ihok@xxxxxxxxxxx>
- Date: Wed, 29 Aug 2007 23:57:44 -0000
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?
.
- Follow-Ups:
- Re: why warn on undefined $1?
- From: Gunnar Hjalmarsson
- Re: why warn on undefined $1?
- References:
- why warn on undefined $1?
- From: ihok@xxxxxxxxxxx
- Re: why warn on undefined $1?
- From: xhoster
- Re: why warn on undefined $1?
- From: Ben Morrow
- Re: why warn on undefined $1?
- From: ihok@xxxxxxxxxxx
- Re: why warn on undefined $1?
- From: Gunnar Hjalmarsson
- why warn on undefined $1?
- Prev by Date: Re: why warn on undefined $1?
- Next by Date: Re: why warn on undefined $1?
- Previous by thread: Re: why warn on undefined $1?
- Next by thread: Re: why warn on undefined $1?
- Index(es):