#!/usr/bin/perl -w use strict; use warnings; use List::Util qw(first); my %test = ( '15.01.2011' => defined, '17.01.2011' => defined, '13.02.2011' => defined, '16.03.2011' => defined, '20.12.2011' => defined, ); foreach my $m (1..12) { if (first { /\.0?$m\./ } keys %test) { print "Monat $m gefunden!\n"; } }