Last fridays of the year

Author: TimToady

Write a program or a script that returns the last Fridays of each month of a given year. The year may be given through any simple input method in your language (command line, std in, etc.).

More

http://rosettacode.org/wiki/Last_Fridays#Raku

Features used

The MAIN sub - https://doc.perl6.org/language/functions#sub_MAIN

Date objects - https://doc.perl6.org/type/Date

Source code: last-fridays-of-year.pl

use v6;

sub MAIN (Int $year = Date.today.year) {
    my @fri;
    for Date.new("$year-01-01") .. Date.new("$year-12-31") {
        @fri[.month] = .Str if .day-of-week == 5;
    }
    .say for @fri[1..12];
}