blob: a794ed98e88942e2d156d2c767d489e826755966 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# Test: perl6 ch-2.p6
use v6.d;
sub MAIN () {
my $current_date = Date.new(2000, 1, 1);
my $end_date = Date.new(2999, 12, 31);
while ($current_date < $end_date) {
# Format month and day
my $month = ($current_date.month < 10) ??
'0' ~ $current_date.month !!
$current_date.month;
my $day = ($current_date.day < 10) ??
'0' ~ $current_date.day !!
$current_date.day;
# Date String
my $date_string = $month ~ $day ~ $current_date.year;
# Output the datestring if it's a palindrome
say $date_string
if ($date_string eq $date_string.flip);
# Next Day
$current_date = $current_date + 1;
}
}
|