# This works fine $a = "abc"; $a =~ s/^(?:a(\w))?(\w)$/$1:$2/; # works fine # This produces the warning # "Use of uninitialized value in concatenation (.) $b = "c"; $b =~ s/^(?:a(\w))?(\w)$/$1:$2/;