[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sheflug] Perl tips



At 15:24 25/11/02 +0000, Alex Hudson wrote:
On Mon, Nov 25, 2002 at 02:52:42PM +0000, Steve Tickle wrote:
> Apologies for this since it's not strictly a Linux problem but I'm trying
> to do what I hoped was the relatively simple task of listing the contents
> of a directory in alphabetical order using a perl script.

Perl's sorting by default isn't alphabetical really, so you're probably
interested in the block argument to sort();
Well the problem is that the filename contains a date and is in the form something-dd-mm-yyyy. sort() works OK as long as the filename is something-01-mm-yyyy to something-09-mm-yyyy. When it gets to something-10-mm-yyyy it inserts the file between something-01-mm-yyyy and something-02-mm-yyyy.

For your future reference,

        http://www.perlmonks.org/

is monktastic.
Off to have a look now.

Cheers


Steve

___________________________________________________________________

Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html

 GNU the choice of a complete generation.