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

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?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://977397]
Approved by toolic
[holli]: the chatterbox xml ticker only deleivers fresh data to each client
[holli]: i mean, once you requested it and got the new chatter, the chatter won't appear in the next request
holli keeps hacking along

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2017-09-23 11:59 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (272 votes). Check out past polls.