On Tue, Aug 07, 2001 at 12:14:55PM -0700, Sophia Corwell wrote:
: Hello Perl Help,
:
: Does anyone have any ideas on what is a good way to
: check the existance of a value for a key that has
: multiple values?
I'm not quite sure what you're asking for so I'm going to try and
rephrase your question, then answer that one. :-)
Question: I have a key in my hash that could have several valid
values. For instance, $hash{key} could return "foo" and "bar" and
my program would be ok with that. What is the best way to figure
out what value $hash{key} has?
I hope that I got the question sorted out right in my head. The
answer I would give to that question is, use an if statement:
if ( $hash{key} eq 'foo' ) {
# do stuff based on 'foo' here
} elsif ( $hash{key} eq 'bar' ) {
# do stuff based on 'bar' here
} else {
# we should probably throw an error here because there are no
# valid values of $hash{key} left
}
If I got this wrong, and it's very possible, try and set me straight
so we ( the list ) can help you better.
Thanks,
Casey West
--
Disclaimer - These opiini^H^H geez! ^H^H ^Q ^[ .... :w :q :wq :wq! ^d
X ^? exit X Q ^C ^? :quitbye CtrlAltDel ~~q :~q logout save/quit
:!QUIT ^[zz ^[ZZZZZZ ^H man vi ^ ^L ^[c ^# ^E ^X ^I ^T ? help helpquit
^D ^d man help ^C ^c help ?Quit ?q CtrlShftDel"Hey, what does this
button d... -- Seen in a .signature file
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]