> -----Original Message----- > From: Lysander [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 24, 2002 3:23 PM > To: [EMAIL PROTECTED] > Subject: Trying to use strict > > > Okay, after reading various documents online I have decided > to try and write my code using -w and strict.
Excellent! > > So here is the problem. How do I pass Arrays to subs? I > assume declaring everything main:: would pretty much > undermine the whole point of strict vars. So... for example > I have this sub which sends me mail if there is an error. > > ...snip a huge bunch of stuff... 'use strict' has nothing to do with passing stuff to subs. It is a compile-time pragma that catches common errors due to misspelled variable names, use of symbolic refs, etc. When you add 'use strict' to an existing script, you need to declare the variables used, typically by using 'my' (but sometimes by 'use vars' or 'our'). So, if you use an array @headers in your script, you simply need to add the line my @headers; to the top of your script. Likewise with other variables like this. That's all you need to do. Now, if you misspell it somewhere in your script as @heders, or use $headers{0} when you meant $headers[0], you'll get a nice compile-time error message instead of having to track down why your program isn't behaving properly. HTH -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]