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

In reply to Re: How do I convert a number to a fraction and vice versa? by PodMaster
in thread How do I convert a number to a fraction and vice versa? by PodMaster

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":