On Tue, Feb 24, 2004 at 10:49:50AM -0800, rmck wrote:

> I need this variable $time to show last hour (00..23) So if hour is
> 00, I want 23. If hour is 01, I want 00, etc..... 
> 
> I can run that awk statement on the command line and it works great,
> but if I try it in the script it fails with an awk syntax error... 
> 
> Is there a way to look at last hour with $time1 ?? I would rather keep
> it all perl.....

I suggest

  my $time = sprintf "%02d", (localtime time - 3600)[2];

perldoc -f time
perldoc -f localtime
perldoc -f sprintf

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

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


Reply via email to