[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] More Perl Starmapping



On Mon, Aug 30, 1999 at 06:18:24PM -0700, Brian McNett wrote:
>                 if ($settings{ref_x} =~ /[A-Za-z]+|\s+/) {
>                 print "X coordinate must be numeric.\n";

That's an odd way of testing whether a value is numeric...

Your regex can be reduced to /[A-Za-z\s]/ with the same functionality.  But
that still allows things like '!@#$%^&*()_+', which isn't really numeric.

A simple regex that just enforces characters would be something like
/[-+\d.e]/.

The most reliable method for verifying that a value is numeric is trapping
warnings, but that may be more than you need.

Ronald

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org