in reply to Output To File with Array help
#!/usr/bin/perl use warnings; use strict; my $scalar = 'We Be Killing Zombies Tonite'; my @array = qw( poo.txt moo.txt doo.txt goo.txt ); my @handles; for my $name ( @array ) { open my $FH, '>', $name or die "Cannot open '$name' $!"; push @handles, $FH; } for my $FH ( @handles ) { print $FH $scalar; }
|
|---|