Microsoft
Software
Hardware
Network
Question : How to check if value in a list in Perl?
Hi,
I am trying to create a conditional statement "if" that will check if a value is in a list of values. Right now, I simply do this:
if ( $myvar == 'VAR0123' || $myvar == 'VAR1234' || $myvar == 'VAR2345' )
{
}
I would prefer to setup all my "values" in an array or hash at one place and then do something like:
if ( $myvar ISIN $mylist )
{
}
Can this be done easily in Perl? Maybe using a hash table? Any ideas?
Answer : How to check if value in a list in Perl?
generally, $mylist{$myvar} would be better for this kind of thing than grep or foreach or =~
$i == 'VAR0123'
will match anything that does not look like a number
Random Solutions
configure windows xp back to normal state ... recover xp but do not install windows xp
fldrclnr.dll
Display the email address a sender used.
Can not Hibernate
Installing authentic windows xp (pro or home) over possible unlicensed xp version.
annoying 'not connected' error message, dial up connection pop-ups, when i am connected via wireless network
IPless Post Office detection for Groupwise login
Deal Number Generated automaticly
Tomcat 4.0.6 The requested resource is not available
How can I copy Contacts from one ipaq to another