Please respond to the list. I'm not always available to answer questions.
Now for your questions, loosely numbered: 1,3) You probably either included "use strict" or perhaps included some other code that used strict. That enforces the requirement to lexically scope your variables, among other things. 2) Lexically scoping your variables does not affect your ability to use your variables at all. It just means that they automatically get created at the 'my' statement and destroyed at the end of the code block. If you do need a variable to exist throughout the entire script, you can declare it at the top of your script or use 'our' instead of 'my'. And finally, the question you didn't ask, but I'll answer anyway. I would seriously recommend adding 'use strict' and 'use warnings' in all of your scripts. It can be a real pain at first when you're not used to using it, but it can save you a lot of time in the long run. Keep an eye on the list and you can get a lot of good examples. This question comes up a lot with people who are self-taught. I had to go back and learn to use strict after coding for about a year, and I really wish I had started sooner. A few examples of how adding 'use strict' can possibly save you time: 1. You're looping through an array, using a variable inside the loop. Something fails and the variable doesn't get updated. You don't realize until hours later that all of your output is worthless because half of the loops were just repeating the same value as the loop before it. By declaring the variable using 'my' inside the loop, you can avoid this because the variable will be automatically reinitialized each time. 2. You can't figure out why your program isn't generating the expected output. You spend an hour putting debug statements throughout your script, only to find that you misspelled the name of the variable in your print statement. Perl was happy to oblige you by creating a new, empty variable with that name and printing it for you. By adding 'use strict' to the top of your script, you can avoid this because Perl will complain about the variable not being declared. Check out 'perldoc strict' for more detailed info. -----Original Message----- From: ZHAO, BING [mailto:[EMAIL PROTECTED] Sent: Monday, October 10, 2005 4:20 PM To: Timothy Johnson Subject: Re: hi why do I need to specify $,%,@ using 'my', sometime I do need them to be global so that I can use their property, like scalar @shrimp to get a #, and I have beening programming for a while, and I seldom use my, and this is the 1st time unix has generated such kind of warning, why? thank you very much. bing -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>