in reply to Number?

Oh, try that with "-1.35353E-2". It's a number but your test fails.

Since perl will treat any string as a number and do its very best to make the right choice, you must understand exactly what numbers you are testing for. If you are only interested in positive integers, "/\D/" is fine.

Otherwise you will have to craft a craftier regexp for your particular problem. You can look for non valid chars like this: if ($testit =~ /[^0-9.Ee+-]/) { print "Is bad!"} but keep in mind that fails on stuff like "--3E3E3E++".

The Cookbook has this headache inducer for the worst of circumstances:

if ($t =~/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/) { print "Is Good!"; }

Use that at your own risk tho...

--
$you = new YOU;
honk() if $you->love(perl)