in reply to Re: long if statements... What's the best way?
in thread long if statements... What's the best way?
Be aware of false strings that match.
You could solve this by using defined in this particular case, but it's not a general solution. As Herkum says, any from List::MoreUtils is a better alternative in the general case.use List::Util 'first'; my $var = '0'; if (first { $_ eq $var } $var) { print "Found.\n"; } else { print "Not found.\n"; } __END__ Not found.
lodin
|
|---|