piyush.shourie has asked for the wisdom of the Perl Monks concerning the following question:
I am passing the reference of a HASH to a method, which does not produce the desired result.
Refer the following code:
use XML::Simple; my $config = XMLin("SAMLResponse with attrs.xml"); traverseHash($config); sub traverseHash { my $hRef=@_; print ref($hRef); }
The above code produces no output, indicating that the parameter received is not a hash. However, if the type of variable $config is checked using ref() method, it clearly indicates that it is a HASH.
Please clarify this discrepancy in the result.
Thanks in advance,
Piyush
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Passing Reference of a Hash to a method
by davorg (Chancellor) on Nov 23, 2004 at 10:37 UTC | |
|
Re: Passing Reference of a Hash to a method
by dave_the_m (Monsignor) on Nov 23, 2004 at 10:36 UTC | |
|
Re: Passing Reference of a Hash to a method
by edan (Curate) on Nov 23, 2004 at 10:35 UTC | |
|
Re: Passing Reference of a Hash to a method
by Zaxo (Archbishop) on Nov 23, 2004 at 10:40 UTC | |
by bart (Canon) on Nov 23, 2004 at 11:53 UTC | |
|
Re: Passing Reference of a Hash to a method (simpler)
by Luca Benini (Scribe) on Nov 23, 2004 at 11:31 UTC | |
|
Re: Passing Reference of a Hash to a method
by rrwo (Friar) on Nov 23, 2004 at 18:25 UTC | |
by davorg (Chancellor) on Nov 24, 2004 at 06:34 UTC |