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 |