wrote:
> Many thanks to each and everyone of you who took time to reply - I
> revised my script and it's working in the way I wanted. I learnt more
> than expected 
>
> I didn't realize the "$bytesread" in the construct is "consumed" by the
> "while" evaluation loop;
You're still not getting it. $bytesread is not "consumed" and its
value is not in any way set by the while loop.
The condition of the while loop is the assignment
$bytesread = read($filehand, $buffer, 204

;
The assignment "returns" whatever value is assigned to $bytesread.
Each time the condition is evaluated, read() is called. read() returns
the number of bytes read from $filehand, which will be between 0 and
2048. If read() read any bytes at all, $bytesread will get a non-zero
value, and therefore be true. In that case, the the while loop
executes, because it's condition is true. When read() finally returns
0, $bytesread is 0, which is a false value, and so the while condition
is false and the loop ends.
> and had a hard time to find the resource for
> this, and for things like how the syntexis is defined in
> "read($filehand,$buffer,204
",
Did you try:
perldoc -f read
?
> from my 7 good perl books from O'Reilly.
Did you try the chapter in the Camel (which I have to assume you count
among those seven) which documents each and every Perl built in
function, including read()?
> Online materials/tutorials are great and learning by
> examples is most efficient for me, but sometimes I fell into
> embarrassment before experts
Forgive me if this is rude, but it does not take an "expert" to read
the documentation for the function you're using.
Paul Lalli