in reply to output format changed perl5.8 --> perl 5.10?
Do you really need each component of the timestamp in individual vars? Are they being used elsewhere or are they just being used to build up your tstamp and dstamp strings?
IMO, it would be much cleaner and easier to use the strftime function from the POSIX module.
#!/usr/bin/perl use strict; use warnings; use POSIX qw(strftime); my $dstamp = strftime("%Y%m%d", localtime(time)); my $tstamp = strftime("%H%M%S", localtime(time)); print "tstamp is $tstamp\n"; print "dstamp is $dstamp\n";
Which outputs this format:
tstamp is 092141 dstamp is 20140425
|
|---|