Your skill will accomplish what the force of many cannot |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Ronnie, you've stumbled onto one of the darker corners of Perl, the difference between lexical (my) variables and package/global (our, local) variables. The critical expression here is:
This code attempts to use $DB_name as a symbolic-reference to find the hash to be indexed. Strict-mode forbids symbolic-references because they don't work with lexical (my) variables. When you turn off strict you get the package variable %IWSTEST (or whatever is in $DB_name) which doesn't exist since you declared your hashes with my(). Ok, so now you know what the problem is, how should you solve it? Here are two options:
Give it a try and post a new question if you're still having trouble. -sam In reply to Re: hash name as a variable?
by samtregar
|
|