in reply to Alternative to using system grep

By all means us the perl functions / code when you can but I'm just guessing the errors you are seeing with grep might be due to the search path for programs (ie $PATH) not including the directory that contains 'grep'. You could try specifying the full path to grep like
my @arr = `/usr/bin/grep -l "<value>IsFrequentlyUsed</value>" *`;