laziness, impatience, and hubris PerlMonks

### Comment on

 Need Help??
I forgot how to decorate for descending sort.

Just negate the field(s). Unary minus ('-') for numeric and boolean not ('~') for alpha:

```# Ascending numeric and ascending alpha
print for map{
unpack 'x[Na4]a*', \$_
} sort map{
local \$^W;
pack 'Na4a*', (0+\$_), substr( \$_, 1), \$_
} @a;;
0cjlf
0dvys
0uvmu
1akkn
1imwi
1lpys
1pjzw
2uwep
3hiyn
3jrkx
3myrn
3ozcw
3rqhx
3vkon
6excm
7axqf
7lbhj
8klfd
9ijei
9klou

# Descending numeric and ascending alpha
print for map{
unpack 'x[Na4]a*', \$_
} sort map{
local \$^W; pack 'Na4a*', -(0+\$_), substr( \$_, 1), \$_
} @a;;
0cjlf
0dvys
0uvmu
9ijei
9klou
8klfd
7axqf
7lbhj
6excm
3hiyn
3jrkx
3myrn
3ozcw
3rqhx
3vkon
2uwep
1akkn
1imwi
1lpys
1pjzw

# Ascending numeric and descending alpha
print for map{
unpack 'x[Na4]a*', \$_
} sort map{
local \$^W;
pack 'Na4a*', (0+\$_), ~substr( \$_, 1), \$_
} @a;;
0uvmu
0dvys
0cjlf
1pjzw
1lpys
1imwi
1akkn
2uwep
3vkon
3rqhx
3ozcw
3myrn
3jrkx
3hiyn
6excm
7lbhj
7axqf
8klfd
9klou
9ijei

# Decending numeric and descending alpha
print for map{
unpack 'x[Na4]a*', \$_
} sort map{
local \$^W;
pack 'Na4a*', -(0+\$_), ~substr( \$_, 1), \$_
} @a;;
0uvmu
0dvys
0cjlf
9klou
9ijei
8klfd
7lbhj
7axqf
6excm
3vkon
3rqhx
3ozcw
3myrn
3jrkx
3hiyn
2uwep
1pjzw
1lpys
1imwi
1akkn

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^4: two order sort by BrowserUk
in thread two order sort by ag4ve

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

• Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
• Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
• Read Where should I post X? if you're not absolutely sure you're posting in the right place.
• Please read these before you post! —
• Posts may use any of the Perl Monks Approved HTML tags:
a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
• You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
 For: Use: & & < < > > [ [ ] ]
• Link using PerlMonks shortcuts! What shortcuts can I use for linking?
• See Writeup Formatting Tips and other pages linked from there for more info.

Create A New User
Chatterbox?
 erix suddenly wants to hear My Sweet Lord once more [AnomalousMonk]: LanX: I should have written "vessel". Rama was (is? - I'm still hoping) no asteroid.

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (12)
As of 2017-11-22 17:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
In order to be able to say "I know Perl", you must have:

Results (327 votes). Check out past polls.

Notices?