Oh cool thanks. works like a beaute. I couldn't figure out how the $a and $b were derived.. I've got alot more reading to do now..
many thanks again... thanks, George Vieira Systems Manager Citadel Computer Systems P/L -----Original Message----- From: Andre Pang [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 19 December 2001 11:45 AM To: Sydney Linux Users Group (E-mail) Subject: Re: [SLUG] Perl Glob On Wed, Dec 19, 2001 at 11:43:15AM +1100, George Vieira wrote: > Again with this globbing.. I can't see anything about using glob in reverse > order only using nosort. > > I'm using this: > > my $dir = "./news/*.n"; > @files = glob("$dir"); from "perldoc -f sort": sort SUBNAME LIST sort BLOCK LIST sort LIST Sorts the LIST and returns the sorted list value. one of the examples given is: # same thing in reversed order @articles = sort {$b cmp $a} @files; use '<=>' instead of 'cmp' if you want to sort numerically instead of lexically (see the perlfunc manpage for more information), e.g. "@files = sort {$b <=> $a} @files;". so glob the directory first, then sort it afterward. -- #ozone/algorithm <[EMAIL PROTECTED]> - trust.in.love.to.save -- SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/ More Info: http://lists.slug.org.au/listinfo/slug -- SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/ More Info: http://lists.slug.org.au/listinfo/slug
