use IO::File; my %handles = map { $_ => IO::File->new($_) } @filenames;