[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] TMTOWTDI #2



At 09:10 AM 6/29/99 +0300, Ariel Scolnicov wrote:
>Here's an "any more", but probably not a "better":
>
>     @pnames = qw(blastp blastn blastx tblastn tblastx);
>     $re = join '|',@pnames;
>
>     # Get $program by hook or by crook
>     $program =~ /$re/o;
>
>For robustness, you'd probably want to use something like
>     $re = join '|', map {"\Q$_\E"} @pnames
>instead.
>
>Of course, for a large list of @pnames (but how many BLASTs are there,
>anyway?), you'd go with the hash method, but at least it's OMWTDI.

how about:

@pnames = qw(blastp blastn blastx tblastn tblastx);
if (grep /^$program$/, @pnames)
{
    # success
}






==== Want to unsubscribe from Fun With Perl?
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org