SPUG: deferencing a hash in an array of hashes
daniel at chetlin.com
Tue Nov 7 00:54:45 CST 2000
On Mon, Nov 06, 2000 at 05:43:09PM -0800, Alex Leites wrote:
> Is that because you expected %hash to be printed as before, with key
> => value format? Well, perl debugger won't do that for "simple" hashes
> ("simple" meaning that there are no references among the values) --
> the other format is reserved for more complicated data structures.
> Try 'x \%hash' if you want to cheat. Or use Data::Dumper.
Data::Dumper will do the same thing as the debugger's `x' command. There
would be no way for it to work otherwise, as a hash is indistinguishable
from an array once it's been pushed onto the stack. It's also
indistinguishable from passing several scalars, or two arrays, or an
array and a hash, etc. From Data::Dumper's (or `x's) point of view, it's
just a bunch of stuff on the stack. The only way for them to see the
structure is passing by reference. So `x \%hash' isn't cheating at all,
and neither is `Data::Dumper::Dump \%hash'. It's the way to do it.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
More information about the spug-list