Created
July 26, 2023 22:22
-
-
Save s1037989/dba3217fddba2bc61f4c77f2f24185e7 to your computer and use it in GitHub Desktop.
reduce a list of dates to those less than X
This file contains hidden or 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
$ perl -Mojo -MTime::Piece -E 'say c(qw(2022.11 2022.12 2023.01 2023.02 2023.03 2023.04 2023.05 2023.06 2023.07))->reduce(sub{push @$a, $b if Time::Piece->strptime($b, "%Y.%m") < Time::Piece->strptime($ARGV[0]||localtime->strftime("%Y.%m"), "%Y.%m"); $a}, c())->join(",")' 2023.02 | |
2022.11,2022.12,2023.01 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment