fizbin has asked for the wisdom of the Perl Monks concerning the following question:
I'm calling some code that expects to receive a hashref. (The XMLout method of XML::Simple, if you must know). I want to pass in a tied hash, since I want to control the order that keys come out when this code runs through them with each. Unfortunately, the code contains this construct:
Now, the problem is that when I pass in a tied reference, it appears that %$ref is always false; that is, the code never even calls each on my tied hash.if (ref($ref) eq 'HASH') { # ... some code ... if (%$ref) { while (($key, $value) = each %$ref) { # ... recurse into the structure ... } } # ... some more code ... }
Is there some magic method I'm missing to let me have scalar(%h) be true when %h is a tied hash?
-- @/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/; map{y/X_/\n /;print}map{pop@$_}@/for@/
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Is it possible to control scalar(%h) when %h is a tied hash?
by thospel (Hermit) on Oct 20, 2004 at 02:49 UTC | |
by fizbin (Chaplain) on Oct 20, 2004 at 03:22 UTC | |
by BUU (Prior) on Oct 20, 2004 at 04:43 UTC | |
by fizbin (Chaplain) on Oct 20, 2004 at 17:02 UTC | |
by fizbin (Chaplain) on Oct 20, 2004 at 17:13 UTC | |
|
Re: Is it possible to control scalar(%h) when %h is a tied hash?
by dragonchild (Archbishop) on Oct 20, 2004 at 02:58 UTC |