Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Golf: reverse sort /etc/passwd by UID

by tobyink (Abbot)
on Feb 06, 2013 at 10:23 UTC ( #1017376=note: print w/ replies, xml ) Need Help??


in reply to Golf: reverse sort /etc/passwd by UID

OK, using salva's wonderful Sort::Key, I can go five characters shorter...

perl -MSort::Key=rikeysort -e'print rikeysort{/(\d+)/;$1}<>' /etc/pass +wd

If you don't mind a spurious blank line at the end of the output, then it's easy to drop another two characters...

perl -MSort::Key=rikeysort -E'say rikeysort{/(\d+)/;$1}<>' /etc/passwd
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name


Comment on Re: Golf: reverse sort /etc/passwd by UID
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2015-07-06 08:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls