c:\@Work\Perl\junque>perl -wMstrict -e "my $file = 'junk'; for my $s (qw(foo bar baz)) { open my $fh, '>>', $file or die qq{opening '$file': $!}; print $fh qq{this is $s \n} or die qq{writing '$file': $!}; close $fh or die qq{closing '$file': $!}; } " c:\@Work\Perl\junque>cat junk this is foo this is bar this is baz