in reply to a natural way of expressing things
There are a number of different ways to check to see if the value is in a list. I provided a regex alternation but there is also grep or, for the truly bizarre, Quantum::Superpositions. Note: the alternation regex can be constructed using join.my $name = $tree->ancestor->son->sibbling; if ($name =~ /john|jacob|jingle|heimer|smitz/) { # ... }
Minor update regarding the reason why you store the result in a shorter variable.
Cheers - L~R
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: a natural way of expressing things
by Anno (Deacon) on Jul 09, 2007 at 11:45 UTC |