[Chicago-talk] isolating the values to right and left of the decimal
tiger peng
tigerpeng2001 at yahoo.com
Wed Jan 9 13:01:43 PST 2008
Here is my solution for fun:
perl -e '$t=13.32; $t =~ s/(\d+)(\.\d+)/$1.":". (int $2*60 + .5<10?"0":"").int $2*60 + .5/e; print "$t\n"'
----- Original Message ----
From: Richard Reina <richard at rushlogistics.com>
To: chicago-talk at pm.org
Sent: Saturday, January 5, 2008 3:36:48 PM
Subject: [Chicago-talk] isolating the values to right and left of the decimal
After over an hour of googling and searching in my Lama, Camel and Ram books I still am unable to find a way to convert
13.32 to: thirteen hours and nineteen minutes
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.
Thanks,
Richard
Your beliefs become your thoughts. Your thoughts become your words. Your words become your actions. Your actions become your habits. Your habits become your values. Your values become your destiny. -- Mahatma Gandhi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20080109/fe2534bc/attachment.html
More information about the Chicago-talk
mailing list