CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Sorting

 



zjedzmnie
Novice

Jan 5, 2009, 7:56 AM

Post #1 of 1 (420 views)
Sorting Can't Post

Hi, I'm new and I need same help. And at first sorry for my English

I'm trying to sort my table. I'm using this and it doesn't work

my @lslh = map{$_->[0]}
sort{$a->[1] <=> $b->[1]}
map{/-(access)(.*?)(\d+)$/; [$_,$3]} @grep;

And my table look like this:
Jan 5 access.log
Jan 5 access.log.1
Dec 27 access.log.10.gz
Dec 26 access.log.11.gz
Dec 25 access.log.12.gz
Dec 24 access.log.13.gz
Dec 23 access.log.14.gz
Dec 22 access.log.15.gz
Dec 21 access.log.16.gz
Dec 20 access.log.17.gz
Dec 19 access.log.18.gz
Dec 18 access.log.19.gz
Jan 4 access.log.2.gz
Dec 17 access.log.20.gz
Dec 16 access.log.21.gz

And I need to sort it by id's access.log. A make a example:
Jan 5 access.log
Jan 5 access.log.1
Jan 4 access.log.2.gz
Dec 27 access.log.10.gz
Dec 26 access.log.11.gz
Dec 25 access.log.12.gz
Dec 24 access.log.13.gz
Dec 23 access.log.14.gz
Dec 22 access.log.15.gz
Dec 21 access.log.16.gz
Dec 20 access.log.17.gz
Dec 19 access.log.18.gz
Dec 18 access.log.19.gz
Dec 17 access.log.20.gz
Dec 16 access.log.21.gz

Only "Jan 4 access.log.2.gz" change your position.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives