Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

help with sprintf

by mhearse (Chaplain)
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

Replies are listed 'Best First'.
Re: help with sprintf
by toolic (Bishop) 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?
[Corion]: ambrus: Sorry for running out on you yesterday regarding the HTTP module discussion
[Corion]: I hope I'll find time to turn my quest(ion) into a SoPW ;)

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2016-12-08 10:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (139 votes). Check out past polls.