open( SH, "| /bin/sh" ) or die "Can't open /bin/sh: $!"; # whatever you loop construct is... { # assign command line args to @args # ... CAREFULLY! (watch out for shell "magic" characters, # escape them as needed) print SH "myscript.pl -h @args\n"; }