in reply to Conditional idiom : "if X equals Y or Z" ??

Quantum::Superpositions is one way. and in perl 6, i believe any and all will be built-in functions. arguably the most basic, and fastest method is to use binary logic.

my %actions = ( GetAll => 0x001, Make => 0x010, MakeOnly => 0x100, ... ); $_->{Suppress} = 0x001 if ($_->{Action} & ( $actions{GetAll} | $actions{Make} | $actions{Ma +keOnly} );

~Particle *accelerates*

Replies are listed 'Best First'.
Re: Conditional idiom : "if X equals Y or Z" ??
by Abigail-II (Bishop) on Jun 11, 2002 at 11:33 UTC
    I fail to see how that's supposed to work. $_ -> {Action} is either "GetAll","Make" or "MakeOnly", and not some bitpattern.

    But using a hash leads to one solution:

    my %match = map {$_ => 1} qw /GetAll Make MakeOnly/; ... $_ -> {Suppress} = 1 if $match {$_ -> {Action}};

    Abigail