VB 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 > > # The program is interactive, as: > print "Program name: "; > chomp ($program = <STDIN>); my %val; @{$val{''}}{qw(p n x)} = (); @{$val{'t'}}{qw(n x)} = (); if ( $program =~ /(\w{0,1})blast(\w)/ and exists $val{$1}{$2} ) { print "$program -- VALID\n"; } else { print "$program -- INVALID\n"; } Btw, this looks like homework. Is this FWP list just your clever way of getting free work from the best Perl consultants in the world? (Not that *I'm* one of them...) John Porter ==== Want to unsubscribe from Fun With Perl? ==== Well, if you insist... Send mail with body "unsubscribe" to ==== fwp-request@technofile.org