using strictby NovMonk (Chaplain)
|on Mar 22, 2004 at 20:46 UTC||Need Help??|
NovMonk has asked for the wisdom of the Perl Monks concerning the following question:
I have been converted to "use strict, warnings, etc." (Wait, hold your applause....) I've read many of the FAQ's and nodes on the subject, and even found where they buried the initial discussion of "strict" on page 31 of my battered copy of Perl by Example (And they never mention it again in said examples, for all I can tell.)
Here's my remaining confusion-- it looks as if you can declare a variable as you assign it a value, thus:
my $a = 5;
But, I'm assigning several variables at once to the results of a split, and "strict" is not happy with it until I declare them all at the top of the program thus:
my ($a, $b, $c);
Here's my script prior to adding the my line declaring everything at the top -- what am I missing, or what should I go back and read a few more times?
Running this program as it is gives me the error:
I don't know why it likes the first my ($junk, $recno); line but not the second.
Thanks for gentle enlightenment. If I can't get that, the other is fine too ;-).