On 4/25/07, Somu <[EMAIL PROTECTED]> wrote:
Actually the following isnt working:

 use Math::BigFloat;
 $n = 0;
 if ($n->is_zero()) {print 'you entered zero'}
snip

Umm, that is because $n is not a Math::BigFloat.  Math::BigFloat is
not a pragma, it is a class that overloads the math operators so it
can be used like a normal number.

#!/usr/bin/perl

use strict;
use warnings;
use Math::BigFloat;

my $n = Math::BigFloat->new(0);
print "you entered zero\n" if $n->is_zero;

$n += 1;
print "is it still zero?\n";
if ($n->is_zero) {
       print "yes! How odd.\n";
} else {
       print "no.\n";
}

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


Reply via email to