try dumping after the foreach loop print Dumper \@files; it will output $VAR1 = [ undef, undef, undef ];