[Chicago-talk] isolating the values to right and left of the decimal
dave at obtiva.com
Sat Jan 5 14:15:45 PST 2008
Richard Reina <richard at rushlogistics.com> wrote:
> my $time_sring = 13.32;
> my $hrs = sprintf "%0d", $time_string; # works. I get 13
> but I can't figure out how to get .32 so that I can multiply it time 60 and
> then round it so that I can print out:
> thirteen hours and nineteen minutes
> Any help would be greatly appreciated.
I'm sure there's a better way to do it, but here's the first to pop
into my mind.
$decimal = 12.34;
@sides = $decimal =~ /(\d+)/g;
print $sides, "\n";
//obtiva - agilty applied. software delivered.
More information about the Chicago-talk