If you really want to interpolate a variable into the name of another variable, as you are doing, which is called a symbolic reference, you need to turn off strict 'refs'as in:
# UNTESTED.
print "this one works: $other0{'cat1'}\n";
{
no strict 'refs'
print "problem here: ${$catnames[0]}{'cat1'}\n $catnames[0]->{'cat
+1'}";
}
This turns off strictness as regards symbolic references between the innermost contiaing braces.
However:
- this only fixes the first half of the 'print "problem here...", the second interpolation is still wrong.
-
As others have noted, you really should not use symboic references if you can use the other kind
--Bob Niederman, http://bob-n.com