On 4/2/08, Richard Lee <[EMAIL PROTECTED]> wrote:
> What is the best way to indicate past hour from current time without
> using a module?
>
> so if it's 12:00, then 11:00-12:00
>

I'd prefer using POSIX module since it's a built-in perl module.
The code would be simple,

use strict;
use POSIX 'strftime';

print get_time(time - 3600),"-",get_time(),"\n";

sub get_time {
    my $timestamp = shift || time;
    return strftime("%H:%M",localtime($timestamp));
}

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to