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