On Wed, Apr 21, 2010 at 8:38 AM, newbie01 perl <newbie01.p...@gmail.com> wrote: > Hi all, > > If I declare a variable x1 outside of the sub that makes it global, right? > Now the question is can I have the same variable x1 as a local variable of a > sub, i.e. will the following work? > > $x1 = "cat"; > > sub sample() > { > my $x1="dog"; > ... > ... > }
You can. > > Just trying to work out some guidelines on using variables, i.e. using > local, my or global and some naming converntion stuff ... > > Is there some good links on such guidelines? > You really should read this article: http://perl.plover.com/FAQs/Namespaces.html.en -- Jeff Pang http://home.arcor.de/pangj/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/