#!/usr/bin/perl use IO::Handle; use strict; use warnings; my $pos= tell *DATA; my $pid= fork(); die unless defined $pid; if ($pid == 0) { my $x= IO::Handle->new(); $x->fdopen(fileno(DATA), "r"); seek $x, $pos, 0; print "Start c $pos\n"; while (<$x>) { print "c: $_"; } print "stop c\n"; } else { my $y= IO::Handle->new(); $y->fdopen(fileno(DATA), "r"); seek $y, $pos, 0; print "Start p $pos\n"; while (<$y>) { print "p: $_"; } print "waiting for child\n"; wait; print "stop p\n"; } __DATA__ a b c d e