open( SH, '|-', '/bin/sh' ) or die "Can't open a shell: $!"; for my $iterator ( @whatever_set ) { print SH "command line…\n" } close SH;