in reply to Uninitialized $1 in s///

I've been known to rant about that warning a time or two, so I'd suggest just turning it off. Since the override is lexically scoped, this won't affect other parts of your code....
$b = "c"; { no warnings 'uninitialized'; # turn off bogus warning for this bl +ock $b =~ s/^(?:a(\w))?(\w)$/$1:$2/; # voilla, no warning!! }

-Blake