in reply to Simple math gone wrong

maybe you want to use one of the Math Modules (look for them at CPAN).