in reply to storing variable names in an array

Unless you need the names of the files in some specific order that is not easily obtained through sorting, you are much better off storing the file names in a hash.

my %names = (file1 => "tom", file2 => "bob", file3 => "joe");

Then if you need to change what file2 points to just do it directly.

$names{file2} = "sam";

To iterate over the %names...

for (keys %name){ print "$_ = $names{$_}\n"; }