which gets me "109.98 2 NaN" Same if I add a bunch of '+=0' statements, like so:my $retail_rate = $self->{'TOUR'}->{'RATE'}{$rateid}{'retail_rate'}; my $coupon = $self->{COUPONAMOUNT}; my $discounted_rate = $retail_rate - $coupon; print "$retail_rate $coupon $discounted_rate\n";
It's still "109.98 2 NaN" Even when I don't subtract $coupon, I'm still ending up with NaN values.my $retail_rate = $self->{'TOUR'}->{'RATE'}{$rateid}{'retail_rate'}; my $coupon = $self->{COUPONAMOUNT}; $retail_rate += 0; $coupon += 0; my $discounted_rate = $retail_rate - $coupon; print "$retail_rate $coupon $discounted_rate\n";
It's still "109.98 2 NaN" But get this:my $retail_rate = $self->{'TOUR'}->{'RATE'}{$rateid}{'retail_rate'}; my $coupon = $self->{COUPONAMOUNT}; $retail_rate += 0; $coupon += 0; my $discounted_rate = $retail_rate + 1; print "$retail_rate $coupon $discounted_rate\n";
gives me "109.98 2 110.98." But even then adding onto $discounted_rate sends me back to NaN land. 12 years coding Perl and somehow I've forgotten basic addition. It's time for me to put in an application an Burger King, right?my $retail_rate = $self->{'TOUR'}->{'RATE'}{$rateid}{'retail_rate'}; my $coupon = $self->{COUPONAMOUNT}; $retail_rate += 0; $coupon += 0; my $discounted_rate = $retail_rate; $discounted_rate++; print "$retail_rate $coupon $discounted_rate\n";
In reply to Getting different results with $var++ and $var += 1 by splicer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |