While I agree that debugging code - particularly code that you're still familiar with - is usually just as easy/difficult with or without globals, the Real Reason that I have discovered that people scope things and use 'my' are as follows:

People use 'my' along with 'use strict' to make sure typos don't get taken seriously. Auto-vivification is cool in some contexts, but I just plain don't see the difference between $options{debug} and $optoins{debug}. Perl does, though, if %options is declared and I have 'use strict' enabled. This has saved me hours of debugging time chasing typos.

People use local variables in subs because they like to turn them into modules that get used in other programs, and sometimes those other programs already have another variable - used for something else - by the same name. I always use $mib, $sess, $var, $vb, and $vl in my SNMP-related scripts. Straight from the man page for SNMP.pm. This would be a problem if I didn't do a lot of my code in modules (along with 'use strict', 'my', etc. etc.).

I don't find that having local vs. global variables has helped my debugging any, though (not that I use proper debugging techniques, AFAIK).

You said "...I just plain don't see the difference between $options{debug} and $optoins{debug}."

I've had bugs like that. I don't know what would take more time, debugging such bugs or initializing every variable. The former is rare. The latter would have to be done all the time.

Luckily, I have VarStructor 1.0 to list all my variables so I could see if I made such a typo. And there is no module that does a better job listing the variables within a script. Diotalevi thought he had a contender, then demerphq thought he had one. Bugs were brought to their attention shortly thereafter. If the only contribution VarStructor 1.0 has made to the Perl community is to highlight the bugs in competing modules, and get them repaired, it was worth it. And now that the bugs are fixed in the competing modules, VarStructor 1.0 STILL kicks their ass.

I deleted the VarStructor 1.0 code from Perlmonks a few days ago, so I guess you all have one more reason to use strict than I do. This isn't a local variable issue anyway, incase nobody noticed.

You said "People use local variables in subs because they like to turn them into modules that get used in other programs..."

Ok. No-one says you have to do it. We're simply explaining why we choose to 'use strict', initialize every variable, scope things as tight as possible, and all that other crap.

I don't know what would take more time, debugging such bugs or initializing every variable. The former is rare. The latter would have to be done all the time.

Personally, I find it a lot easier to declare every variable immediately, because it helps me keep track of things. That may not be a concern of yours, so my experiences may not have relevance to you. I also prefer to have Perl determine when I typo something vs. running a separate program. Again, different strokes.

I also find it helpful to scope variables as tightly as possible, because it helps me understand the code I just wrote. I choose to keep as few details in my head as possible. This requires me to organize my code in a certain way, so that I can immediately understand the code I wrote in a glance. Again, I am not saying that I have "The Holy Writ"(tm) when it comes to coding styles. I'm only describing those practices that help me, personally, and explaining why I recommend them to people who ask.

------
We are the carpenters and bricklayers of the Information Age.

Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

I shouldn't have to say this, but any code, unless otherwise stated, is untested