my @dates; my string='All kinds of text 01-01-2003 Perl Party more text 01-01-2004 Perl Party and even more text 01-01-2005 Perl Party and finally some other date 01-01-2006'; if ($string=~/([0-9]{2})-([0-9]{2})-([0-9]{4})\s$/ {my $date="$1\.$2\.$3"; push @dates, %date}} #### my @substrings=split( /Perls\sin\sParty/, $string); for my $substring (@substrings) { if ($substring=~/([0-9]{2})-([0-9]{2})-([0-9]{4})\s$/) { my $date; $date="$1\.$2\.$3"; print "There is a Perl Party on $date\n";} #### if ($substring=~/([0-9]{2})-([0-9]{2})-([0-9]{4})\s$/) { my $date="$1\.$2\.$3"; my $testdate="$1\.$2\.$3"." Perl Party"; if ($string=~/$testdate/ { print "There is a Perl Party on $date\n";} }}