P
Paul Lalli
Gunnar said:Then I have a problem with the maths. Which 4 posts explain that the
STDIN contents in $buffer is replaced by the return value from read()?
Alright, fine, I overestimated. Two posts:
http://groups.google.com/group/comp.lang.perl.misc/msg/e9017fc8aa1c572d
:: From perldoc -f read:
::
:: Attempts to read LENGTH characters of data into variable SCALAR from
:: the specified FILEHANDLE. Returns the number of characters actually
:: read...
::
:: You are overwriting the $buffer contents with the number of
characters.
http://groups.google.com/group/comp.lang.perl.misc/msg/7479274c2876d0d4
:: $buffer is passed as the second argument to the function, and
:: the function fills that buffer. It then returns HOW MANY BYTES
:: WERE READ, not the actual text. Therefore, you're reading, for
:: example, "Hello World", which Perl is storing into $buffer
:: automatically. But then you immediately replace that string with
:: the number 11, because you assigned the $buffer variable to the
:: return value of read().
Where?
The second one I just quoted.
What about ability to count? ;-)
Damnit, Gunnar, I'm a programmer, not a mathematician! ;-)
Paul Lalli