In perl the false values are 0, "0", "" and undef. If any of these values are returned, you exit the loop, while if you read the docs for getc, the value returned when there are no characters to read is always undef which can be differenciated from the other falses by testing with the defined function instead of basic truth.
So you want to turn the while line to:
while( defined($_=getc(STDIN)) ){
In reply to Re: getc() question
by repson
in thread getc() question
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |