Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: Packages Question Message-ID: <8247@jpl-devvax.JPL.NASA.GOV> Date: 31 May 90 00:35:46 GMT References: <1990May30.212950.26190@viusys.uucp> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Distribution: usa Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 32 In article <1990May30.212950.26190@viusys.uucp> tomb@viusys.uucp (Tom L. Baitz) writes: : I guess I'm totally missing the boat, but why doesn't this work? : : $val1 = 1; : $val2 = 2; : print "$val1 $val2\n"; : &testsub; : print "$val1 $val2\n"; : exit; : : package abc; : : sub main'testsub { : $valx = 3; : main'$val2 = $valx; : } : : The error I get is: : EOF in string at test2.pl line 12. You've misplaced your dollars. :-) 12c12 < main'$val2 = $valx; --- > $main'val2 = $valx; The name of the variable is actually val2, not $val2. The $ is just sort of a type mark that says you are referring to a scalar value. Package name modifiers (and subscripts) bind more tightly. Larry