in reply to subroutines and returning lists...

@returned_files = match_files(\@array, \%hash);

should do fine, if the last statement in match_files() is indeed return @files. Are you sure match_files() does not return before that? Also, if @files is empty, the function will return an empty list. Try manually adding an element to that array to make sure that it indeed returns something.