in reply to subroutines and returning lists...

Your first example, with
@returned_files = match_files(\@array, \%hash);
looks like it should work.

Also, to dereference an array reference, try @$returned_files

Compare these examples. The first returns a reference to an array:

#!/usr/bin/perl -w use strict; sub ret_array { my @array = qw( 1 2 3 4 5 ); return \@array; } my $returned_array = ret_array(); print @$returned_array;

And this returns an array
#!/usr/bin/perl -w use strict; sub ret_array { my @array = qw( 1 2 3 4 5 ); return @array; } my @returned_array = ret_array(); print @returned_array;