Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Sorting @lines

by JaWi (Hermit)
on Oct 10, 2002 at 19:58 UTC ( [id://204309]=note: print w/replies, xml ) Need Help??


in reply to Sorting @lines

This sounds like a job for a Schwartzian Transform! I'm too tired to give you any example code at the moment... Sorry!
Update: What a sip of beer can do! Here you go:
use strict; use Data::Dumper; my @data = qw( 124.43.adsf.ca 235.23.aer.ca 100.34.asdm.ca ); my @sorted = map { $_->[ 0 ] } sort { $a->[1] cmp $b->[1] } map { [$_, /(\d+\.\d)/] } @data;

Greets,

-- JaWi

"A chicken is an egg's way of producing more eggs."

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-19 20:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found