in reply to How do I convert a number to a fraction and vice versa?

use Number::Fraction:
use Number::Fraction; my @dimensions = ( 320, 240 ); my $aspect = Number::Fraction->new( @dimensions ); print join('x', @dimensions); print $aspect; print $aspect->to_num;
320x240 4/3 1.33333333333333