> Hi, > I would like to divide a floating point number into its whole and fractional > parts. > So, > ($w, $f)= some_subroutine(12.735) > assigns 12 to $w and 0.735 to $f. > > Any easy perlish way of doing this?
Someone no doubt will have a one liner, but here is a logical way of achieving the result #!/usr/bin/perl -w use strict; my $nr = "12.75"; my ( $whole, $part ) = ( int($nr), $nr - int($nr) ); print "$whole $part\n "; Owen -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/