Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: output format changed perl5.8 --> perl 5.10?

by fishmonger (Hermit)
on Apr 25, 2014 at 16:33 UTC ( #1083809=note: print w/ replies, xml ) Need Help??

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

Comment on Re: output format changed perl5.8 --> perl 5.10?
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1083809]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2015-11-25 08:27 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (672 votes), past polls