Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

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

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: (5)
As of 2016-10-29 00:49 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (387 votes). Check out past polls.