Here is the code to match 0 to 10 using regex.
use warnings; use strict; print "Enter any number:"; my $input = <STDIN>; chomp($input); if($input=~ m/^10$|^[0-9]$/) { print "matched"; } else { print "not matched"; } Hope it helps. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 02, 2008 2:09 PM To: beginners@perl.org Subject: how to write 0 to 10 in reg exp. Hi, How do I write the expression, if the variable match between 0 to 10? Below is the wrong expression I wrote which is suppose to be if $eightdecks match 0 to 10. So i want the answer to be yes. Thanks my $eightdecks = 6; if($eightdecks =~ /[0-10]/){ print "Yes match\n"; }else{print "no"}; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/