in reply to trick or treat

You stringify $a and $b when you bind them to a substitution. That removes their reference magic, converting them to strings. When you try to dereference them two lines later, the operation fails under strict, but succeeds without strict by taking the string as a symbolic reference and finding no such structure.

Are you trying to convert an array ref to a hash ref with that? The string you see when printing a reference is generated - it isn't the actual form of a live reference.

Minor nit - avoid $a and $b as variables. They are sacred to sort.

Update: To convert hard array references to hash references, and vice versa, you need to convert the underlying array or hash:

my $foo = [1..4]; print $foo, $/; $foo = {@$foo}; print $foo, $/; $foo = [%$foo]; print $foo, $/;

After Compline,
Zaxo