C:\>perl -e "my $test = 'Hallo#Welt#sdf#asd#asd#'; print qq~yes\n~ if $test =~ m!(?:#.*?){5}!;" yes