Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Sorting @lines

by JaWi (Hermit)
on Oct 10, 2002 at 19:58 UTC ( #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? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2022-08-19 08:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?