Here's one way:

#\d represents a digit
#this regex checks to see if every character (besides possibly a trailing
\n) is a digit

if($var =~ /^\d+$/){
   do something...
}else{
   don't
}

-----Original Message-----
From: Helen Dynah [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 11:45 AM
To: [EMAIL PROTECTED]
Subject: Variable question



Hi everyone.

 

I was wondering how you would determine whether a variable is a number or
not.  I want to do an if statement such as

if ($variable is a number) {...

 

Any help is great.  Thanx,

 

Helen



---------------------------------
Find, Connect, Date! Yahoo! Canada Personals

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to