From owner-freebsd-chat Fri Sep 15 9: 9: 1 2000 Delivered-To: freebsd-chat@freebsd.org Received: from scientia.demon.co.uk (scientia.demon.co.uk [212.228.14.13]) by hub.freebsd.org (Postfix) with ESMTP id E263E37B43C; Fri, 15 Sep 2000 09:08:54 -0700 (PDT) Received: from strontium.scientia.demon.co.uk ([192.168.91.36] ident=root) by scientia.demon.co.uk with esmtp (Exim 3.16 #1) id 13ZxVi-0008SY-00; Fri, 15 Sep 2000 16:34:42 +0100 Received: (from ben@localhost) by strontium.scientia.demon.co.uk (8.9.3/8.9.3) id QAA57898; Fri, 15 Sep 2000 16:34:41 +0100 (BST) (envelope-from ben) Date: Fri, 15 Sep 2000 16:34:41 +0100 From: Ben Smithurst To: Mark Ovens Cc: chat@freebsd.org Subject: Re: perl(1) variable declarations Message-ID: <20000915163441.A56185@strontium.scientia.demon.co.uk> References: <20000915130220.C257@parish> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <20000915130220.C257@parish> Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Mark Ovens wrote: > Is > > use vars qw/ $foo $bar /; > > the same as > > my $foo; > my $bar; > > when used for global variables? I think "my" variables won't work if you want to set them from another file, but I don't remember exactly. e.g. ==== main ==== my ($foo, $bar); require "globals.pl"; print "foo=$foo bar=$bar\n"; ============== ==== globals.pl ==== $foo = 1; $bar = "sheep"; ==================== I don't think this will work, but I think it will if you use "use vars" instead. That's the only difference I recall coming across, so I always use "my" except in cases like the above. -- Ben Smithurst / ben@FreeBSD.org / PGP: 0x99392F7D To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message