On Fri, 12 Mar 2004, Jeff Westman wrote:
> Is there a way in perl to get the month/day/year using localtime
> WITHOUT using 'use POSIX qw(strftime)' or a system "date" call.
>
> Something using slices, maybe.... something like:
>
> print scalar ((localtime(time))[4,3,7])
>
> expecting the result to be 03122004.
Try something like this;
-----------------------------------------------------------
#!/usr/bin/perl
use strict;
use warnings;
my @t = localtime(time);
print (sprintf("%02d%02d%04d",$t[4] +1,$t[3],$t[5] +1900));
------------------------------------------------------------
Owen
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>