Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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 pondering the Monastery: (7)
As of 2014-12-28 04:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (178 votes), past polls