in reply to sub functions return array's

Hard to say without your full code, but a few comments:
You are using an empty prototype with sub getfiles() - why?
Where are your variables coming from? use warnings; use strict
Are you capturing the reference being returned correctly?

The following works for me:
#!/usr/bin/perl use strict; use warnings; sub getfiles { my ($logSite) = @_; my @uploads; opendir DIR,$logSite or die "Unable to open Directory, please try ag +ain"; foreach my $pattern (@ARGV) { push (@uploads, grep /$pattern/, readdir(DIR)); } closedir DIR; return \@uploads; } my $ref = getfiles('.'); print "@$ref\n";