in reply to Uninitialized $1 in s///
This code does not generate a warning under 5.6.1, so an easy answer would be to upgrade your version of Perl.
An other way is to use the /e option is the substitution:
$b =~ s/^(?:a(\w))?(\w)$/defined $1? "$1:$2" : ":$2"/e; <>The /e option evals the right part of the s/// operator, so you can test whether $1 is defined or not.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Uninitialized $1 in s///
by Aristotle (Chancellor) on Jan 02, 2002 at 20:18 UTC | |
|
Re: Re: Uninitialized $1 in s///
by dmitri (Priest) on Jan 02, 2002 at 20:43 UTC |