http://www.perlmonks.org?node_id=505419

my $life_cycle=1; my %have_all = (plant=>"tree", write=>"book", ihave=>"child" ); my %acctions = (play=>soccer, know=>book, sleep=>fantasy, other=>other, girl=>know, book=>mmmmmm, perl=>past, hand=>community, more=more, life=realy?, what=how, ); my $large_life_cycle = 3; while ($life_cycle) { $have_all{$_}= $acctions{$_} foreach %acctions; $mission_competed += find_love(%have_all) exit if mission_competed == $large_life_cycle ; } print "Wait for me final victory \n"; sub find_love { my %all = @_; foreach my $anything (keys %have_all) { $have_all{plant} = "is ok" if $have_all{plant} =~ /tree/; $have_all{write} = "is ok" if $have_all{write} =~ /book/; $have_all{ihave} = "is ok" if $have_all{ihave} =~ /child/; return 1 if $have_all{$anything} =~ /is ok/; } }