Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

help with sprintf

by mhearse (Hermit)
on Jun 20, 2012 at 16:33 UTC ( #977397=perlquestion: print w/ replies, xml ) Need Help??
mhearse has asked for the wisdom of the Perl Monks concerning the following question:

I'm needing help with sprintf. Specifically I need something that generates this list of 4 digit 24 hours. Thanks.
0000 0100 0200 0300 0400 0500 0600 0700 0800 0900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100 2200 2300

Comment on help with sprintf
Download Code
Re: help with sprintf
by toolic (Chancellor) on Jun 20, 2012 at 16:38 UTC
Re: help with sprintf
by cheekuperl (Monk) on Jun 20, 2012 at 16:41 UTC
    @list=map {$_.="00"}("00".."23"); print join("\n",@list);
    Why specifically sprintf?
      The only reason is that I want those hours in an array:
      my @times; for (0..23) { push @times, sprintf "%02d00", $_; } print Dumper(\@times);

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://977397]
Approved by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (15)
As of 2014-09-02 21:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (30 votes), past polls