Good day;

try:::
if ($input =~ /\d+\.?\d+/){
xxxxxxx

}
The intent here is:
         \d+ ##one or more digits
         \.?  ##followed by zero or one "." (there is a dot there)
         \d+ ##followed by one or more digits.

I think this will work. Depending on how your reals will be input, you can 
tweak the \d to suit your needs.
Hope this helps/works.
Carl

At 01:56 PM 5/30/2001 -0700, you wrote:
>Hi,
>I'm new to the group and new to Perl and am very glad to have such a 
>resource available. Hopefully someday I'll be on the giving end of the 
>help list but for now I'm stumped. How do I test an input to see if it is 
>a real number?  I have a situation something like:
>
>  $input = <STDIN>;
>         chomp $input;
>
>if (input equals a real number) {
>         xxxxxx
>}
>else {
>xxxx
>}
>best, michael

Reply via email to