John W.Krahn <[EMAIL PROTECTED]> writes:

> man 2 lseek
> [ SNIP ]
> NOTES
>        This document's use of whence is  incorrect  English,  but
>        maintained for historical reasons.

OK, I see how having used WHERE in the perldoc stuff would be out of
step with what its all based on.

>> Even here what the heck does `;;' mean.  This stuff is supposed to be
>> readable by someone who doesn't know these things.
>
> This shows the influence that the C programming language has on Perl.  
> for (;;) { ... } is used in C for an infinite loop.  In Perl you could 
> also write that as while (1) { ... }.

A few posters have now mentioned that... good info ..thanks.

>
>> Even down to
>> `curpos'.  I didn't get what it meant for a few seconds.  Why not
>> spell it out... $CurrentPostion.  After all clarity is what we're
>> after here.
>
> Perl programmers usually frown on the use of CamelCase variable names.

Interesting... I wasn't so wedded to the humps as to spelling out the
names and thereby indicating instantly the expected content.

I think Java programmers may use the humps a lot but I know even less
about Java.  I use the humps for my own scripts (at least on longer
names) because I find it harder to tell the meaning at a glance when
it is in all lowercase like `$currentpostion'.  I guess the humps
act kind of like spaces in normal language to my eye.

Do you know wy perl programmers prefer same case variable names?

[...]

> , , , , , , , , , , , , , , , , , , , , Also $bytes starts 
> out at 0 so the expression -($bytes -100) will be equal to +100 which 
> is 100 bytes past the end of the file.  You probably want to do this 
> instead:

And that was the immediate cause of failure.  I wanted to use it like
the unix cmd tail to display the last few lines of a file prior to
adding more lines so the rerun would display a few original lines and
the added lines.  But I went the wrong way as you noted.  Thanks.

So it turns out that even with my confusion on reading the perldoc and
sniveling about it... that documentation was still enough for me to
get the code mostly right.  Missing the math part wasn't related to
what I read there.

Even my crummy original code works changing `>>' to `+>>' and -100 to
100.   But I see now where `Fcntl ':seek';' would be smarter to use.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to