Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Re: Reading Filenames

by Parham (Friar)
on Jan 04, 2002 at 08:02 UTC ( #136208=note: print w/replies, xml ) Need Help??

in reply to Re: Reading Filenames
in thread Reading Filenames

forgot to log in :P

i didn't see a single reply that said "why don't you sort @files after getting it".. so i'm here to say it just put this after your statement:

@files = sort @files;

and that'll fix your problems :)

Replies are listed 'Best First'.
Re: Re: Re: Reading Filenames
by archen (Pilgrim) on Jan 04, 2002 at 20:01 UTC
    As was said before, readdir (where'd the '@' come from?) is very system dependant. You might also note that MS Windows is not case sensitive, while Unix is. So if you wanted to make sure that the list came out the same on every operating system, you should probably do a case insensitive sort. Then again if you're sticking to Unix, a strait sort will be faster.
    @files = sort { lc($a) cmp lc($b) } @files;
    Update - oops, nevermind. I don't know what I'm talking about... not enough sleep.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://136208]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2016-10-01 17:36 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (1 votes). Check out past polls.