-
-
Save tadzik/ca52a6ef8d125dd9b28a5245b92ed913 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use 5.020; | |
use strict; | |
use warnings; | |
use DateTime; | |
my $date = DateTime->now; | |
my $month = $date->month; | |
my $days_left = 0; | |
while ($date->month == $month) { | |
if ($date->day_of_week < 6) { | |
$days_left++; | |
} | |
$date->add(days => 1); | |
} | |
say "$days_left workdays left in month (including today)"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $date = Date.today; | |
my $month = $date.month; | |
my $days_left = 0; | |
while ($date.month == $month) { | |
if ($date.day-of-week < 6) { | |
$days_left++; | |
} | |
$date = $date.later(:1day); | |
} | |
say "$days_left workdays left in month (including today)"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> time perl remaining.pl | |
11 workdays left in month (including today) | |
perl remaining.pl 0,10s user 0,02s system 99% cpu 0,121 total | |
> time raku remaining.raku | |
11 workdays left in month (including today) | |
raku remaining.raku 0,20s user 0,04s system 135% cpu 0,174 total |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment