in reply to Hash references?

Two problems.

The first problem is the second my. The argument of my needs to be a variable name (not an expression such as %$foo) or a parenthesized list of variable names. Remove the my, and package variable %bar will be populated.

Well, not quite. By using use strict;, you're explicitly telling Perl to disallow you from doing what you want to do. And rightfully so. What you want to do is highly discouraged: Why it's stupid to 'use a variable as a variable name'. Using a Hash of Hash (HoH) would be a better approach. See FunkyMonk's reply to see how that's done.

Replies are listed 'Best First'.
Re^2: Hash references?
by Anonymous Monk on May 03, 2008 at 06:22 UTC
    Because of the way the actual script is structured, I already had a hash of hashes, and I was trying to avoid creating a hash of hashes of hashes (HoHoH?) by creating the HoHs with soft references. However, after reading "Why it's stupid to 'use a variable as a variable name' ", I now realize that it's really just easier to deal with the three dimensional hash. Thanks again for the Perl Wisdom.