Why doesn't this sample code work correctly?

```
#/usr/bin/perl

$a = "aaa%29";
$a =~ s/%/\\x/g;
print "a  $a \n";
$b = "aaa\x29";
print "b  $b \n";
$c = sprintf($a);
print "c  $c \n";

```

I want to get three times the same output line.