Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

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?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2015-11-28 03:59 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (737 votes), past polls