in reply to Imaginary / Complex numbers

I think you want Math::Complex from CPAN. This is probably the easiest and most standard way of handling it.