eventual wrote:
Hi,
Hello,
Looking at the script below, how do I write a range of 10 to 80 as a regular
expression.
I tried [10 - 80] but it wont work.
Thanks
##### script ##############
#!/usr/bin/perl
my $player_total_points = 70;
if ( $player_total_points =~/^(10..80)$/ ){
print "yes";
}else{
print "no";
}
Why not just do it like this:
if ( $player_total_points >= 10 && $player_total_points <= 80 ) {
But as a regular expression it would be something like this:
if ( $player_total_points =~ /\A(?:[1-7][0-9]|80)\z/ ) {
John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction. -- Albert Einstein
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/