awarsd wrote:
Hi,
I have a number $page = 500;
now i want to check that if $page matches a word character then make $page
=1;
so originally i did this
my $page =500;
if(($page =~ /\w/) || ($page <= 0)){
$page=1;
}
print"$page";
since it always returns $page = 1; then i did this
if(($page =~ /(\w)/) || ($page <= 0)){
$page=$1;
}
so it displayed the word 5, how come 5 is considered as a word??
perldoc perlre
\w is alphanumeric plus '_', i.e. [a-zA-Z0-9_]
so to fix it i just did
if(($page =~ /(\D)/) || ($page <= 0)){
$page=$1;
}
And everything worked ok!!
any help is appreciated
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]