From owner-freebsd-chat Sat Sep 16 6:26:40 2000 Delivered-To: freebsd-chat@freebsd.org Received: from flood.ping.uio.no (flood.ping.uio.no [129.240.78.31]) by hub.freebsd.org (Postfix) with ESMTP id C43C637B53A; Sat, 16 Sep 2000 06:26:34 -0700 (PDT) Received: (from des@localhost) by flood.ping.uio.no (8.9.3/8.9.3) id PAA45129; Sat, 16 Sep 2000 15:26:34 +0200 (CEST) (envelope-from des@ofug.org) X-URL: http://www.ofug.org/~des/ X-Disclaimer: The views expressed in this message do not necessarily coincide with those of any organisation or company with which I am or have been affiliated. To: Mark Ovens Cc: chat@FreeBSD.ORG Subject: Re: perl(1) variable declarations References: <20000915130220.C257@parish> From: Dag-Erling Smorgrav Date: 16 Sep 2000 15:26:33 +0200 In-Reply-To: Mark Ovens's message of "Fri, 15 Sep 2000 13:02:20 +0100" Message-ID: Lines: 14 User-Agent: Gnus/5.0802 (Gnus v5.8.2) Emacs/20.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Mark Ovens 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