素直に分からないから教えてくださいってお願いできないものかね
プロセス間通信でググってよく調べとけよ

open my $pipe, '|-', 'grep -E "3|4|5"';
for (0..100) {
sleep 1;
print $pipe "$_\n";
}