The reason your code did not give you any errors/warnings is because you told perl that you didn't want to know about your errors. You did that by not including the strict and warnings pragmas, which should be in every Perl script you write.

What you're attempting to do is use symbolic references, which is a really bad idea and only works on global vars, not lexical vars which are declared with the 'my' keyword.