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

Re^5: Challenge: sort weekdays in week-order (elegantly and efficiently)

by rsFalse (Chaplain)
on Jul 25, 2022 at 22:51 UTC ( [id://11145728]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Challenge: sort weekdays in week-order (elegantly and efficiently)
in thread Challenge: sort weekdays in week-order (elegantly and efficiently)

Should also work:
print "$_\n" for sort_by { lc =~ tr/hfst/x-z/dr } @weekdays; # Monday +first print "\n"; print "$_\n" for reverse sort_by { scalar reverse lc =~ tr/rn/at/dr } +@weekdays; # Sunday first
  • Comment on Re^5: Challenge: sort weekdays in week-order (elegantly and efficiently)
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (None)
    As of 2024-04-25 00:35 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found