#implement learnings: #substring matching ~~ #incremental substring match against a key that may not be given yet. return 0 learning... #maybe add counter of the times the substring match a key use strict; use warnings; use diagnostics; my %match: my @char; my $str = 'abcdefghjki'; #substr could match a 2 letter key or 10 letter to a hash key... my @char = split //, $str; #assigned string into array to check foreach my $key (keys %match){ if($match->[0] ~~ @char) # i don't know how to check an incremental test for the substring against the key in hash.don't know proper syntax. { #do something } } #return num of times sub finds in for my $keys ($keys){ $match{$keys}++; print "this is the number of times we see for $keys :",$match{$key},"\n"; }