in reply to Re: Open, ye! And read from your child!
in thread Open, ye! And read from your child!

Doh! You would think a (relatively) seasoned Perl Junkie would have noticed that list context blurp. Ok the new code that works is:

#!/usr/bin/perl -w use strict; if (my $pid = open(READ, "-|")) { print "child said: '", scalar <READ>, "'; ",time,"\n"; print "child said: '", scalar <READ>, "'; ",time,"\n"; } else { $|=1; print "hello; ",time,"\n"; sleep 2; print "how are you; ",time,"\n"; }
And output:
gryn@echor:~$ ./testcase.pl child said: 'hello; 1005597768 '; 1005597768 child said: 'how are you; 1005597770 '; 1005597770

The buffering is necessary, as you all pointed out. However, with the list context problem in the way, I couldn't figure out where to properly put the (de)buffering until it was fixed.

Thanks and kudos to you three,
Gryn