Shlomi Fish writes:
http://perl-begin.org/tutorials/bad-elements/#declaring_all_vars_at_top
> 
> (Note: perl-begin.org is a domain I originated and maintain).

Shlomi Fish, Uri and Brock,

        I certainly wish I had known about a resource like this
earlier in my relatively short perl career.

        One can find limitless samples of good and bad perl code
on the internet and from textbooks but programming languages
really shine when one knows why or at least somewhat knows why
the coding is done in a certain way which usually boils down to
making it easier to comprehend by someone else or making it
easier or even possible for the compiler or interpreter to
process.

        I knew I could probably cobble together something that
fixed the problem I was asking about but the way the code I
wrote failed told me that I didn't understand all I thought I
knew.

        I actually thought pre-declaring the variables was a
good thing since I had been doing that in C and various
assemblers for 35 years if you count all the way back to when I
got in to computing by accident after going to college to do
something totally different.

        I expect the large code I have written will now work
after applying the following quote from your site:

>   However, this is bad form in Perl, and the preferable way is to declare
>   all the variables when they are first used, and at the innermost scope
>   where they should retain their value. This will allow to keep track of
>   them better.

Again, thanks for creating this great resource. I hope I can
stop reading it long enough to fix the problem at hand.

        My last day of work before retirement is Monday, March 2
but I will just be starting something new at the age of 63
rather than going away.

Martin McCormick

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to