# name: basicipc.pl # # Purpose: Receive the STDOUT from a secondary app in real time # and do some basic translation on it. End when the secondary # app ends. my $cmd = 'perl delayed.pl'; open(CMD, "$cmd |") or die "Can't open $cmd: $!"; while () { my ($num) = /(\d+)/; print $num % 2 ? 'odd: ' : 'even: '; print $_; } close(CMD); #### # name: delayme.pl # # Purpose: Simulate an external process sending delayed # output to STDOUT for input into a script. my $MAX = 5; # In Seconds; for (1..$MAX) { sleep 1; print "Step $_ of $MAX\n"; }