$ cat kidseek #!/usr/bin/perl -w use strict; $| = 1; print "One\nTwo\nThree\n"; if( ! fork() ) { seek( STDOUT, 4, 0 ) or die "Can't seek STDOUT in child: $!\n"; print "Kid"; seek( STDOUT, 0, 0 ) or die "Can't again seek STDOUT in child: $!\n"; exit; } wait(); print "Dad"; $ ./kidseek >kidseek.txt $ cat kidseek.txt Dad Kid Three $