#!/usr/bin/perl my $pid = fork(); if ($pid) { exit; } else { $| = 1; for (1..3) { print "foo"; print STDERR "bar\n"; sleep 1; } print "done.\n"; }