print "\$x[$_] = ${$x[$_]}\n" for 0..$#x; ^^ ^ LHS is $foo, RHS is $$foo. The output is very misleading. print "\${\$x[$_]} = ${$x[$_]}\n" for 0..$#x; LHS is $$foo and RHS is $$foo. But we're interested in $foo. print "\$x[$_] = $x[$_]\n" for 0..$#x; LHS is $foo and RHS is $foo. Output is correct and shows that the needed change did not happen.