On Tue, Mar 11, 2008 at 2:46 PM, Rodrick Brown <[EMAIL PROTECTED]> wrote: > > On Tue, Mar 11, 2008 at 2:23 PM, <[EMAIL PROTECTED]> wrote: > > Hi, > > How do I shorten this code:- > > > > if $playercard1 = 10 or $playercard1 = "J" or $playercard1 = "Q" or > > $playercard1 = "K"; > > > > Thanks > > > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > http://learn.perl.org/ > > > > > > > > #!/usr/bin/perl -w > use strict; > use warnings; > > my $playercard1=uc <STDIN>; > print "Player has high card\n" if ( $playercard1 =~ /10|J|Q|K/ ) >
Opps I ment to type the following instead. print "Player has high card\n" if ( $playercard1 =~ /^(10|J|Q|K)$/ ) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/