Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
i used the ff code to sort it alphabetically,@array = ("/media/banana.jpg","/media/Apple/apple.jpg");
the problem is that since 'A' goes first before 'b' "/media/Apple/apple.jpg" goes on top of the array. i wanted it to be sorted so that files that were found outside of a folder be on the top, then files in a folder at the bottom.@array = sort mysort @sort; sub mysort { lc($a) cmp lc($b); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sorting Directory and Filenames
by zwon (Abbot) on Jan 10, 2009 at 17:08 UTC | |
by Anonymous Monk on Jan 10, 2009 at 18:22 UTC | |
by ikegami (Patriarch) on Jan 10, 2009 at 19:13 UTC |