Cody Pendant has asked for the wisdom of the Perl Monks concerning the following question:
I'm not in charge of the naming conventions here, I have to take what I can get.
The files are named with leading digits. The digits are good. I'd be happy to keep them in the order of the leading digits.
But my readdir() produces an array in a weird order for two files named with hypens and numbers elsewhere in the string: Here's the stretch from 50 to 60:
50doppelgangland.html
51enemies.html
52earshot.html
53choices.html
54prom.html
57freshman.html
58livingconditions.html
55grad-1.html
56grad-2.html
59theharshlightofday.html
60fearitself.html
Now I've solved my problem by doing a @listoffiles = sort {$a <=> $b} @listoffiles;, and it appears that the spaceship operator parses the files for usable numbers at the start and ignores the rest, so they come out:
50doppelgangland.html
51enemies.html
52earshot.html
53choices.html
54prom.html
55grad-1.html
56grad-2.html
57freshman.html
58livingconditions.html
59theharshlightofday.html
60fearitself.html
so, not really urgent, but what the hell was going on before? It's a LINUX server.
--
($_='jjjuuusssttt annootthheer pppeeerrrlll haaaccckkeer')=~y/a-z//s;print;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: What order do my files come from readdir() in?
by jepri (Parson) on Jun 20, 2002 at 00:13 UTC | |
by Cody Pendant (Prior) on Jun 20, 2002 at 08:25 UTC | |
by jepri (Parson) on Jun 20, 2002 at 08:35 UTC | |
by Anonymous Monk on Jun 20, 2002 at 18:30 UTC | |
|
Re: What order do my files come from readdir() in?
by Aristotle (Chancellor) on Jun 19, 2002 at 23:56 UTC | |
|
Re: What order do my files come from readdir() in?
by maverick (Curate) on Jun 19, 2002 at 23:46 UTC | |
by rob_au (Abbot) on Jun 20, 2002 at 00:14 UTC | |
|
Re: What order do my files come from readdir() in?
by ChemBoy (Priest) on Jun 20, 2002 at 18:41 UTC |