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.In reply to Re: Uninitialized $1 in s///
by mirod
in thread Uninitialized $1 in s///
by dmitri
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |