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

Re: [FWP] TMTOWTDI #2



Roland Giersig wrote:
> 
> Brian Keefer wrote:
> > Vicki Brown wrote:
> > > # Problem - we want code to validate input.
> > > # In this particular case, the possible input values are
> > > #     blastx, blastn, blastp, tblastx, tblastn
> > > # so it looks like a job for a regexp
> > >
> >
> > while (<>){
> >         /t?blast[xn]/ && next;
> >         /blastp/ && next;
> >         die "$_ : not valid";
> > }
> 
> This (and all the other answers using regexp) has the problem
> that it doesn't take care of the *rest* of the input string.
> Is leading whitespace allowed? Trailing garbage? Separated
> from the name by whitespace?

Damnit, I couldn't get any sleep until I realized that I forgot my ^$'s.
So, here again, for all to criticize..

while (<>){
         /^t?blast[xn]$/ && next;
         /^blastp$/ && next;
         die "$_ : not valid";
}

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