my @files = @ARGV; for my $fn (@files) { local @ARGV = ($fn); open OUTPUT, '>', "out$fn" or die $!; while (<>) { print OUTPUT $_; } }