Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Challenge: sort weekdays in week-order -- Lokiday

by Discipulus (Canon)
on Jul 22, 2022 at 10:21 UTC ( [id://11145649]=note: print w/replies, xml ) Need Help??


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

bravo choroba!

I was trying something similar but I easily get annoyed by strptime et similia...

Infact even with your code I hit Error parsing time at C:/perl5.26.64bit/perl/lib/Time/Piece.pm line 581.

I'd modify your code to be even more stable, in the case they accept my proposal for 8 days week, adding Lokiday as jolly day free for all :D

my %order = map { split ' ', 'Time::Piece'->strptime("$_", "%d")->strftime('%A %u') } Time::Piece::day_list();

bliako: your solution is already elegant, readable and perlish: dont overcomplicate :)

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^3: Challenge: sort weekdays in week-order -- Lokiday
by choroba (Cardinal) on Jul 22, 2022 at 10:28 UTC
    > even with your code I hit Error parsing time at C:/perl5.26.64bit/perl/lib/Time/Piece.pm line 581.

    That's weird, I'm running it without errors on 5.26.1 (Time::Piece 1.31).

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      I remebemer weird results from strptime and strftime on windows but atm I cannot find the thread, I'll msg you and update the thread if i find something

      This is perl 5, version 26, subversion 0 (v5.26.0) built for MSWin32-x +64-multi-thread $Time::Piece::VERSION 1.3201

      L*

      There are no rules, there are no thumbs..
      Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-25 19:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found