open SH, "| /bin/sh" or die "can't launch subshell: $!"; for my $file ( @files ) { my $cmd = "perl -Ilib $file >> log\n"; print STDERR $cmd; print SH $cmd; # stderr from subshell will go to STDERR } close SH; #### $ run-em-all.pl > log 2> errlog #### $cmd = "echo running $file 1>&2; perl -Ilib $file" print SH $cmd;