Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: simplify sorting of multiple lists

by ccn (Vicar)
on Jul 20, 2004 at 16:48 UTC ( [id://376010]=note: print w/replies, xml ) Need Help??


in reply to simplify sorting of multiple lists

@$_ = sort {$a cmp $b} @$_ for \@list1, \@list2;

you can use map of course, but it's a bad style see perldoc perlstyle

map {@$_ = sort {$a cmp $b} @$_} \@list1, \@list2;

Replies are listed 'Best First'.
Re^2: simplify sorting of multiple lists
by december (Pilgrim) on Jul 20, 2004 at 17:06 UTC
    Ah, thanks for your solution. I was -quite unsuccesfully- trying to use the return value of 'map', so I think the bad style rule doesn't count then. I think the flattening effect of map's return values is what got me stuck. I will use the for-notion, I think. It's quite easy to understand on first sight.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (1)
As of 2024-04-25 01:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found