Re: string comparison



Also sprach Anno Siegel:

> Gunnar Hjalmarsson <noreply@xxxxxxxxx> wrote in comp.lang.perl.misc:
>> Babacio wrote:

>> > But if I guess what you really want to do, try that :
>> >
>> > if ($a eq 'apple' || $a eq 'banana') { etc }
>>
>> or this:
>>
>> if ( grep $a eq $_, ('apple', 'banana') ) {
>>
>> (perldoc -f grep)
>
> ...or use Quantum::Superposition

Yuck. I'd suggest

use List::MoreUtils qw/any/;

if (any { $a eq $_ } qw/apple banana/) {

Tassilo
--
use bigint;
$n=71423350343770280161397026330337371139054411854220053437565440;
$m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($m+=8)<=200);
.