I am trying to reverse an array's listing order received from glob(); Here's my best attempt but I tend to loose one of my files. By this, I mean I have 10 files in my dir and when line 3 proves it, the tables called show only 9 of them, I guess it got poped and ignored. I tried placing it later in the sub but still got back 9. Is there something else I can use or a different approach to doing this?
perldoc didn't have much help for me on this, unless I am looking it up wrong
Thank you in advance. JayBee
$glob = "../dir/*.txt";
@listoitems = glob( $glob );
print br, 'Found: ', $#listoitems + 1, ' items', br;
$i=0;
print '<table width="600">';
foreach $item (@listoitems) {
$item = pop(@listoitems);
$i++;
if ($i>9){$i=0;}
if ($i =~ /0|2|4|6|8/) {
@file=get_data($item); ##process and read the file
tab1($file[0], $file[1], $file[2], $file[3], $file[4]);
} #end if even#
else {
@file=get_data($item); ##process and read the file
tab2($file[0], $file[1], $file[2], $file[3], $file[4]);
} #end if odd#
} #end foreach#
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.