Greetings Monks,
I am trying to write a code that would take next 5 files, and a previous according to the hour. My files are in
file_00.txt, file_01.txt , file_02.txt, file_03.txt
naming convention ( file_HOUR.txt ). If the Hour is 0 ( i.e midnight) i need to take file_23.txt, file_00.txt, file_01.txt, file_02.txt, file_03.txt, file_04.txt. - and accordingly for subsequent hours. But i am kind of stuck of putting up this logic, my so far code is
use Data::Dumper;
@array_time=localtime;
if ( $array_time[2] == 0 ) {
print "Now the time is |$array_time[2]|..\n";
$firstFile = "file_"."23.txt";
print "First File will be |$firstFile|\n";
}
pointers to this is greatly helpful.
Thanks
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.