in reply to Perl and Quaternions
Math::Trig provides lots of useful trig functions. Maybe cylindrical_to_cartesian() will give you the right answer?
Why not post an example of your expected results? It would make testing any suggestions easier.
In Section
Seekers of Perl Wisdom