Hi everybody,

I'm trying to check weather a variable is an integer, i have tried the following:

use Math::BigRat;
my $x = 42;
print "$x is an integer\n" if $x->is_int();

But it doesn't work, it gives me the error:

Can't call method "is_int" without a package or object reference at test.pl line 3.

Can somebody give me a hint what i am doing wrong, or is there a better way to check if a variable is numeric ?


Thanks

Mads

--
Mads N. Vestergaard - http://rwxr-xr-x.dk
Interested in Open Source, and web application development

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


  • is_int Mads N. Vestergaard

Reply via email to