I like the map idea, though I'd probably end up with a subroutine. Here's what I find myself doing:
sub open_for_write {
my @filenames = @_;
my @fh; # or my %fh;
for my $fn (@filenames) {
my $fh;
# does it exist?
# is it zipped?
# open for append?
# open with create?
$fh[@fh] = $fh; # wink, wink
# or $fh{$fn} = $fh;
}
return @fh; # or return \%fh;
############
my @filehandles = open_for_write( @filenames );
# or my $filehandles_hashref = open_for_write( @filenames );
-QM
--
Quantum Mechanics: The dreams stuff is made of