in reply to while reading a file, transfer the same data to two different processes.

Maybe something like this?

open my $func1, "|-", q{perl -ne 'print "function1 (PID $$): processin +g $_"; sleep 1'}; open my $func2, "|-", q{perl -ne 'print "function2 (PID $$): processin +g $_"; sleep 3'}; use IO::Handle; $func1->autoflush(); $func2->autoflush(); while (my $record = <DATA>) { print $func1 $record; print $func2 $record; } __DATA__ foo bar baz

Output:

$ ./840957.pl function1 (PID 21667): processing foo function2 (PID 21668): processing foo function1 (PID 21667): processing bar function1 (PID 21667): processing baz function2 (PID 21668): processing bar function2 (PID 21668): processing baz