in reply to return hash table

Re-read the docs for File::Find. The return value of wanted is discarded. It's definitely not returned by find.

Replace

my %fileInfo = find(...); sub wanted { ... $fileInfo{$fileName} = $fileName; return %fileInfo; }

with

my %fileInfo; find(...); sub wanted { ... $fileInfo{$fileName} = $fileName; }

Actually, I'm not sure why you are using a hash.

my @fileNames; find(...); sub wanted { ... push @fileNames, $fileName; }

By the way, please use <c>...</c> tags around code posted to PerlMonks.

Update: Original post (follows behind readmore) was junk. I latched onto the wrong problem.

Your code boils down to

my %fileInfo = func(); sub func { ...put stuff in %fileInfo... return %fileInfo; }

You are setting and assigning to the same variable. That makes no sense. (Specifically, the problem is due to the run-time effect vs compile-time effect of my, but fix the other and this goes away.) Fix:

my %fileInfo = func(); sub func { my %fileInfo; # Work with a local variable. ...put stuff in %fileInfo... return %fileInfo; # Return the local variable. }

or

my %fileInfo; func(); sub func { # Work with a global variable. ...put stuff in %fileInfo... }

In this case, I'm not sure which one you need since I don't know what find returns or what find expects of wanted.