in reply to Recusive reference to an array
let it (your script) run with -w (and even better also use strict) and you get warnings about useless use of variables, cause you gave a ref to the sub but U R working on the original not with that ref, so check filesArry and myArray
just 0.02
Have a nice day
All decision is left to your taste
Update
Does your sub give anything back? why not? Do you really want it to modify values in the rest of your script? ok, you said that it would work in PHP , but I doubt that this is a good way to do it in PHP (and for sure it's not in perl). Better give values or refs to your sub and let it do its job on these (and only on these) and then give back a result ( as a value or a ref).