Question : Finding the right permutation of a list of words

Complete the bash script below.  Points awarded to the smallest/fastest, most maintainable code.  Please don't write it in perl or python -- this is a bash question.  If you must use per/sed/awk to parse, then please keep it to a minimum.  The perfect answer will use some combination of bash builtins only.

#!/bin/bash

a=(Where Is My Function)

function MyFunctionIsWhere {
        echo "the answer is 42"
}

function ThisIsTheWrongFunction {
        echo "Don't call this one."
}

# - The words in the "a" array may name a function that I want to call (MyFunctionIsWhere).
# - There can only be zero or one functions named by the "a" array.  So if you find one, stop.
# - If there are zero functions that are named, display "none".
# - If there is a function named by the "a" array, display its name.
# - "define -F someFunctionName" will return the name of a function if it is
#   defined, else it will return nothing (and set $? to 0:1 accordingly)

Answer : Finding the right permutation of a list of words

declare -F | perl -ne 'BEGIN{$a=join"",map"(?=.*$_)",@ARGV;$o=join"|",splice @ARGV}print if /declare -f $a($o)*$/' ${a[@]}
Random Solutions  
 
programming4us programming4us