loris has asked for the wisdom of the Perl Monks concerning the following question:
Hello Hash Honchos,
I have a subroutine which returns a hash, except when things go wrong, in which case it returns undef. I then want to test the result to see what happened:
my %hash = getHash(); if (%hash == undef) { print "undef\n"; } else { print "not undef\n"; }
Those of you in the know will see that this does not do what I expect. Can anyone enlighten me as to what is going on?
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to have a subroutine return an undefined hash
by Fletch (Bishop) on Apr 26, 2005 at 12:50 UTC | |
by loris (Hermit) on Apr 27, 2005 at 07:47 UTC | |
|
Re: How to have a subroutine return an undefined hash
by dragonchild (Archbishop) on Apr 26, 2005 at 12:55 UTC | |
|
Re: How to have a subroutine return an undefined hash
by Roy Johnson (Monsignor) on Apr 26, 2005 at 12:38 UTC | |
|
Re: How to have a subroutine return an undefined hash
by jbrugger (Parson) on Apr 26, 2005 at 12:43 UTC | |
|
Re: How to have a subroutine return an undefined hash
by samizdat (Vicar) on Apr 26, 2005 at 12:49 UTC | |
by Fletch (Bishop) on Apr 26, 2005 at 12:53 UTC | |
by samizdat (Vicar) on Apr 26, 2005 at 12:59 UTC |