APM: Sorting the output of readdir in reverse order

Robert Haig rhaig at hackboy.com
Fri Nov 19 16:19:58 CST 2004


On Fri, Nov 19, 2004 at 03:12:35PM -0700, Bakken, Tom - Temple, TX wrote:
> How would I sort the output of the readdir function in reverse order?
> 
> while (defined($File = readdir(DIR))) {
>   do something
> }
> 
> I've tried various things, all of them messy and failures.  


the first thing that comes to mind is reverse()

@dir=readdir(DIR);
@reversedir=reverse(sort(@dir));

-- 
Rob


More information about the Austin mailing list