#!/usr/bin/perl # https://perlmonks.org/?node_id=1230099 use strict; use warnings; $| = 1; my $me = fork() ? 'parent' : ' child'; while( sysread DATA, $_, 1 ) { print $me eq 'parent' ? uc : lc; select undef, undef, undef, 0.1; } 1 while wait > 0; __DATA__ one two three four five six seven eigth nine ten #### OnE TwO ThReE FoUr fIvE SiX SeVeN EiGtH NiNe tEn