#!/usr/bin/perl use strict; use warnings; my $hour = 0; my @mins = ('00','05','10','15','20','25','30','35','40','45','50','55'); for my $hour (0..23){ for (1..12 ){ print $hour.':'.$mins[0],"\n"; push (@mins,shift(@mins)); #go round the clock } }