Skip site navigation (1)Skip section navigation (2)
Date:      16 Sep 2000 15:26:33 +0200
From:      Dag-Erling Smorgrav <des@ofug.org>
To:        Mark Ovens <marko@FreeBSD.ORG>
Cc:        chat@FreeBSD.ORG
Subject:   Re: perl(1) variable declarations
Message-ID:  <xzpya0so4c6.fsf@flood.ping.uio.no>
In-Reply-To: Mark Ovens's message of "Fri, 15 Sep 2000 13:02:20 %2B0100"
References:  <20000915130220.C257@parish>

next in thread | previous in thread | raw e-mail | index | archive | help
Mark Ovens <marko@FreeBSD.ORG> writes:
> What is the difference (if any) between using ``use vars'' and ``my''
> to declare global variables? Reading perlmodlib(1) and the book
> Learning Perl they appear interchangeable, but are they?

Variables declared with 'use vars' have global scope. Variables
declared with my (which is actually a function) have local scope.

ISTR something about top-level 'my' variables causing leaks or similar
problems in mod_perl scripts, but I don't remember the details.

DES
-- 
Dag-Erling Smorgrav - des@ofug.org


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-chat" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpya0so4c6.fsf>