Path: utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!uflorida!novavax!hcx1!tom From: tom@ssd.csd.harris.com (Tom Horsley) Newsgroups: comp.lang.perl Subject: Re: "MOST COMMON NOVICE BUG" contest Message-ID: Date: 12 Mar 90 12:19:11 GMT References: <15230@bfmny0.UU.NET> <15232@bfmny0.UU.NET> <1118@etnibsd.UUCP> Sender: news@hcx1.SSD.CSD.HARRIS.COM Organization: Harris Computer Systems Division Lines: 30 In-reply-to: vsh@etnibsd.UUCP's message of 6 Mar 90 22:26:54 GMT My most confusing bug as a novice user was believing that local() provided some form of lexical scoping when what it really does is just push a new definition for things with that name. I finally figured this out after trying to debug something that looked like: sub fred { local($barney); ... } ... do fred($barney); It took me a long time to figure out why my subroutine 'fred' was never able to get to the value I thought I passed as the parameter... Actually local() is documented pretty well in the man page, but subroutines are described as using call by reference, but if it was really call by reference, then I would be able to get to the value of the outermost $barney, but I can't. It actually seems closer to call by name. This was especially easy for me to do, because I generally try to use the same name for "the same" variables in all my code. -- ===================================================================== domain: tahorsley@ssd.csd.harris.com USMail: Tom Horsley uucp: ...!novavax!hcx1!tahorsley 511 Kingbird Circle or ...!uunet!hcx1!tahorsley Delray Beach, FL 33444 ======================== Aging: Just say no! ========================