Beefy Boxes and Bandwidth Generously Provided by pair Networks Ovid
XP is just a number
 
PerlMonks  

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 ;~)

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
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2014-04-19 01:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (475 votes), past polls