There are 300 profiles, getvars only sees each of the profiles once (it takes a profile location as an argument)
I am checking to make sure I haven't already ran the profile so as to not run it twice.
I switched to the pipe open as suggested (no significant change in runtime)
I also changed all hash/array refs to standard hashes and returned the refs as suggested (again no significant runtime change)
The files themselves are relatively small and the system command returns approx 30 lines of text which I use in the regex
Thanks for the help