bdimych has asked for the wisdom of the Perl Monks concerning the following question:
Hi all!
I've accidentally found that "getc" and "sysread" behave differently after "exec":
getc does not get remaining data from the STDIN but sysread does it
prints only "a", butecho -n ab | perl -e "print getc; exec 'perl', '-e', 'print getc'"
prints "ab"echo -n ab | perl -e "sysread(STDIN, \$b, 1); print \$b; exec 'perl', +'-e', 'sysread(STDIN, \$b, 1); print \$b'"
why so? where is the "b" in the first case?
Back to
Seekers of Perl Wisdom