use IO::File; my @files; map {push @files, IO::File->new("$_")} qw/foo.txt bar.txt/; map {print <$_>} @files;