On 4/11/07, Chas Owens <[EMAIL PROTECTED]> wrote:
On 4/11/07, Tom Phoenix <[EMAIL PROTECTED]> wrote:
>   my $header_is_complete;  # starts out false

Is there a reason you are not using an our variable instead of a my variable:

TIMTOWTDI. The scope is different, of course; but which scope one
prefers seems largely a matter of style, driven by the ways in which
the programmer imagines using the variable. Earlier in my response to
the OP, I had suggested using a fully-qualified variable; that offers
similar scoping to that of an 'our' variable. Doing it that way would
be another style.

Or even better using a block to hide that variable from other functions:

That's also a good way to affect scope. Doing it that way could also
be good style. In this case, I didn't need to hide that variable with
a block in the example code, partly because I told how to do so in the
text.

In this case, I think you may have been misled by the presence of the
code within the text. My intent was to show several alternative ways
for the OP to choose among. I wrote the code merely to illustrate a
technique that would have been hard to explain clearly without code.
Including that code among other techniques needn't imply that I
necessarily endorse that particular style as the ideal method of
solving the OP's problem. If I had been able to describe each
alternative technique without using code, or if I had written an
explicit example for each possibility, there wouldn't be this
confusion. Having only one piece of example code emphasised that style
unduly, and diminished the others. Nevertheless, having written that
one example and the documentation on its scoping issues, I was (and
still am) content with it.

Here's to good style!

--Tom Phoenix
Stonehenge Perl Training

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


Reply via email to