Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by hippo (Bishop)
on Jul 21, 2022 at 16:47 UTC ( [id://11145640]=note: print w/replies, xml ) Need Help??


in reply to Challenge: sort weekdays in week-order (elegantly and efficiently)

Coming directly to you from the Horrible-But-Works department is this monstrosity:

#!/usr/bin/env perl use strict; use warnings; use Digest::SHA 'sha512256_hex'; my @weekdays = qw/Monday Saturday Thursday/; print join ",", map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { [$_, substr (sha512256_hex (substr (lc ($_), 1, 7)), 26, 1)] } @ +weekdays;

🦛

  • Comment on Re: 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://11145640]
help
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found