
$| = 1;

while (1) {
  print "perl% ";
  my $command = <STDIN>;
  last if $command eq '';
  chomp $command;
  my ($program, @args) = split /\s+/, $command;
  my $pid = fork;
  if (! defined $pid) { print STDERR "Couldn't fork: $!\n" }
  elsif ($pid != 0) { wait }
  else { exec $program, @args;
         die "Couldn't exec: $!\n";
       }
}
