Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks,
It's been a while since I last coded anything (a loooong while, I'm afraid) and it would appear that I need a bit of help to make my coding-starved brain process even the most basic of problems. Here we go...
I've got a subroutine that processes a number of items in a list. The items are all names of hashes. For example:
foreach (qw/hasha hashb hashc/) { @keys = keys %$_; print "There are @keys here"; }
But this attempt doesn't work and results in
Can't use string ("%Blog::Entry::") as a HASH ref while "strict refs" +in use at ./blog.pl line 18.
Would someone please explain to me a) why this is and b) how I might go about accomplishing this better?
Thank you!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using the value of a scalar as a hash
by sgifford (Prior) on Aug 17, 2005 at 20:29 UTC | |
|
Re: Using the value of a scalar as a hash
by davidrw (Prior) on Aug 17, 2005 at 20:33 UTC |