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

Re: [Sheflug] Perl tips



>>>>> "Steve" == Steve Tickle <s.tickle [at] quarndon.co.uk> writes:

> At 15:24 25/11/02 +0000, Alex Hudson wrote:
>> 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.

Is this due to the locality settings?  The following works fine for me:

perl -e 'opendir D, ".";print map "$_\n", sort readdir(D);'

___________________________________________________________________

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

  GNU the choice of a complete generation.

#!/usr/bin/perl -w
# Strip all line of this form from html messages
# From: "French, Alastair" <Alastair.French [at] racalinst.co.uk>
 
while (<>){
        $_=~s/(^.*:.*[ <])(\w.*)(@.*)/$1nospam$3/;
        print unless /^Delivered-To:/i ;
}