in reply to rotating cube.
For an in-depth look at the math (with some other simple formulae you can experiment with), take a look at 3D Projection at Wikipedia.
Back to Perl, if you want to simply plot a non-moving cube (or pre-render a series of video frames) without fancy shading, texture mapping, etc., GD or Image::Magick will do just fine. For more realistic 2D renders or any sort of "live" 3D animation of a rotating cube, have a look at SDL::OpenGL. There is also POGL (OpenGL), but it looks to have gone stale. I am not sure how good SDL::OpenGL is, for that matter.
Honorable mention for 2D work at least would be PDL::Graphics::OpenGL for an OpenGL plugin to the Perl Data Language, but PDL is probably pretty far from what you need to draw a simple cube.