#!/usr/bin/perl -w use strict; use Date::Tie; use POSIX qw(strftime); tie my %base, "Date::Tie"; my $loops; { tie my %meet, "Date::Tie", year => $base{year}, month => $base{month}, day => 1; # Set the week to the week that has the third tuesday $meet{week} += $meet{weekday} <= 2 ? 2 : 3; # Set the day to tuesday $meet{weekday} = 2; # Use the next month if we already met (or met/meet today) $base{month}++, redo if $meet{yearday} <= $base{yearday} and not $loops++; print strftime "%d %B %Y\n", 0, 0, 0, $meet{day}, $meet{month}-1, $meet{year}-1900; }