Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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

by Tommy (Chaplain)
on Feb 05, 2013 at 20:21 UTC ( #1017273=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's quite possible that I'm being exceedingly dense, but how is this any different from just:
perl -E"say reverse<>" /etc/passwd

UPDATE- we only wanted it to work as described below-- with implicit reassignment of $_ to $a and also to $b.

It's not the same. BrowserUK's solution uses two regexes, each with a capture group. The capture groups implicitly assign to what would be the equivalents of "$a" and "$b". Since the point of this excercise was to save typing (potentially at the loss of clarity), BrowserUK didn't bother wasting precious keystrokes in explicitly assigning the result of the regex capture groups to an "$a" or "$b". Instead, he/she (I don't know BrowserUK personally) just let Perl handle those details. BrowserUK definitely meant what was posted ;~)

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1017273]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2018-02-21 11:50 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (279 votes). Check out past polls.