sub benchmark_routine { my ($testFn, $testName)=@_; foreach(@testCases) { my ($sentence, $wantedLetters, $expectedResult) = @$_; $testFn->($sentence, $wantedLetters) for (1..20); die "$testName test failed ($sentence, $wantedLetters)" unless (($testFn->($sentence, $wantedLetters))==$expectedResult); } } #### sub RMGir_indexNot { my ($sentence, $wantedLetters)=@_; # don't need this variable (or any of them, in # fact -- they're just here for clarity. # we could work straight out of @_ if we wanted # this terser # Also, the $[ check is just pedantic - if someone # changes $[, shoot them. return !(grep index($sentence,$_)<$[, split //,$wantedLetters); }