|Do you know where your variables are?|
Re: log() and int() problemby LanX (Bishop)
|on Dec 25, 2012 at 17:17 UTC||Need Help??|
when using Data::Dumper you will see that $l is seen as a string not an integer
print "LOG == ",$l,Dumper \$l,"\n";
LOG == 3$VAR1 = \'3';
As others pointed out log only returns floats up to certain precision, which IIRC also depends on the current implementation of Perl (that is compiling options).
That means the slight calculation error might be too small to be shown by a print but is still sufficient to let == fail. Even if print would show the discrepancy, your approach wouldn't always work.
So better go the other way round and check if 125 == 5**$x with $x=int($l+$tolerance)
EDIT: The approach Moritz updated into his post is even better.