On Wed, 2004-12-01 at 19:04, Bob Showalter wrote: > Ing. Branislav Gerzo wrote: > > Mat Harris [MH], on Wednesday, December 1, 2004 at 12:19 (+0000) > > contributed this to our collective wisdom: > > > > > > Is there any special function for that job? > > > > > personally I would use a rexex: > > > if ($myunknownvalue =~ m/^\d*$/) > > > > personally I would change this regex to: > > if ($myunknownvalue =~ m/^\d+$/) > > because regex given matches also empty set ('') > > Your regex matches the string "123\n", if it matters. > > A simpler approach is to invert the test: > > $var !~ /\D/;
Again Fails for $var=undef; if($var !~/\D/){ print "$var is a number\n"; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>