Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by Tommy (Chaplain)
on Feb 05, 2013 at 20:36 UTC ( #1017279=note: print w/replies, xml ) Need Help??


in reply to Re^2: Golf: reverse sort /etc/passwd by UID
in thread Golf: reverse sort /etc/passwd by UID

It works, using the exact input I specified (as well as my /etc/passwd file...

UPDATE: see my post about me being wrong...

Tommy
A mistake can be valuable or costly, depending on how faithfully you pursue correction
  • Comment on Re^3: Golf: reverse sort /etc/passwd by UID

Replies are listed 'Best First'.
Re^4: Golf: reverse sort /etc/passwd by UID
by thundergnat (Deacon) on Feb 05, 2013 at 20:46 UTC

    Notice that your input is already "sorted". All that one liner does is reverse it.

      Noted. Re-reading perldoc -f sort reveals that the sort of "magic" I thought I was seeing wasn't the case. $a and $b are package globals explicitly passed by Perl itself to the sort block (or subroutine of your definition). It's not a bare leftside-rightside comparison of whatever expressions you may provide. You have to explicitly use the $a and $b package global symbols, and $_ isn't $a/$b. Them's the rules.

      I do indeed stand corrected.

      Tommy
      A mistake can be valuable or costly, depending on how faithfully you pursue correction

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1017279]
help
Chatterbox?
[holli]: yeah, then vroom will personally stab me in the back at night
[holli]: exactly, moritz
[moritz]: with a big table of redirects to support the old links
[LanX]: do it
[holli]: well if you put some cleverness into the migration you can auto convert most of the links as well
[LanX]: Let's Make PerlMonks Great Again!
[holli]: but you know what? i don't think i'd fancy that. I like PM as it is.
[holli]: Alone the chatterbox and everybody writes his own cb client tradition
[LanX]: there was a guy who tried to steal the concept and build an own monastery ...
[LanX]: yeah PM is very emacsy ;-)

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (11)
As of 2017-11-20 19:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (292 votes). Check out past polls.

    Notices?