#!/usr/bin/perl use strict; use warnings; my @t = map("echo Run $_", 1..1000); open(SHELL, "|/bin/sh -") or die $!; sub sys { system($_[0]); } sub sh { print SHELL $_[0],"\n"; } foreach my $i (@t) { sys($i); sh($i); }