in reply to Validating numeric input

There is a very good chapter "NUMBERS" in the Perl Cookbook by Tom Christiansen & Nathan Torkington. This book is a very good starting point for Perl newbies if they are are no programming beginners.
Here are some precooked solutions (the cookbook's equivalent of just-a +dd-water meals) for most common cases. warn "has nondigits" if /\D/; warn "not a natural number" unless /^\d+$/; # rejects -3 warn "not an integer" unless /^-?\d+$/; # rejects +3 warn "not an integer" unless /^[+-]?\d+$/; warn "not a decimal number" unless /^-?\d+\.?\d*$/; # rejects .2 warn "not a decimal number" unless /^-?(?:\d+(?:\.\d*)?|\.\d+)$/; warn "not a C float" unless /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/;
Michael.