It's just that if you don't, there are all kinds of annoying, easily-avoided errors which can get into your code. Using strict reduces the number of possible errors. One very simple mistake: you used "$count" twice in your program to count different things and didn't notice.
while(<FILE>){ # do something $count++; # count lines in FILE } # somewhere else in your script sub count_digits { $string = shift(); $count = $string =~ tr/0-9/0-9/; return $count; }
Now when you use $count, which one is it?
Imagine you call someone for help because your car won't start. He says "You checked the fuel gauge, right? It has gas in the tank?" and you say "oh, I didn't check". He has the right to tell you to go and check and call him back, because that's so obvious. He might love fixing cars, and be prepared to do it for free, but he doesn't want to put gas in the tank for you, where's the fun in that?
When you ask people for help here and you haven't used strict, you're like the guy who hasn't checked the gas. Using strict means your program has been automatically checked for the most obvious kind of error, leaving, hopefully, something more interesting.
($_='kkvvttuu bbooppuuiiffss qqffssmm iibbddllffss')
=~y~b-v~a-z~s; print
In reply to Re: Declaring variables under 'use strict'
by Cody Pendant
in thread Declaring variables under 'use strict'
by Yoda_Oz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |