Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: schwartzian transform

by GrandFather (Saint)
on Oct 13, 2014 at 21:16 UTC ( [id://1103675]=note: print w/replies, xml ) Need Help??


in reply to schwartzian transform

Neither your sample nor your description make it clear how you want the data sorted. However the following may help you sort out whatever it it you want to do:

use strict; use warnings; my @array = map {$_->[0]} sort {$b->[5] <=> $a->[5] || $b->[3] <=> $a->[3]} map {[$_, /(\d+),(\D+)(\d+)(\D+)(\d+)/]} map {chomp; s/'//g; $_} <DATA>; print join "\n", @array; __DATA__ 31 '0,wupra00a0535' 147 '0,wuprm00a0539' 148 '0,wuprm00a0539' 149 '28,wppra02a0015' 150 '24,wppra01a0016' 151 '0,wupra00a0532' 152 '15,wppra01a0015'

Prints:

147 0,wuprm00a0539 148 0,wuprm00a0539 31 0,wupra00a0535 151 0,wupra00a0532 150 24,wppra01a0016 149 28,wppra02a0015 152 15,wppra01a0015
Perl is the programming world's equivalent of English

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1103675]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-26 06:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found