Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Difference between my() and $var = false (http://www.velocityreviews.com/forums/t915330-difference-between-my-and-var-false.html)

Jason C 12-14-2011 04:52 AM

Difference between my() and $var = false
 
Is there a technical difference between these two?

my($var);
$var = false;

Jason C 12-14-2011 07:01 AM

Re: Difference between my() and $var = false
 
On Tuesday, December 13, 2011 11:52:27 PM UTC-5, Jason C wrote:
> Is there a technical difference between these two?
>
> my($var);
> $var = false;


Or, well, I guess I should say $var = undef, not $var = false. Sorry, I haven't really programmed in Perl in awhile.

Mart van de Wege 12-14-2011 07:32 AM

Re: Difference between my() and $var = false
 
Jason C <jwcarlton@gmail.com> writes:

> Is there a technical difference between these two?
>
> my($var);
> $var = false;


The first declares a lexically scoped variable.

The second declares a global variable (and will die on 'use strict').

Mart

--
"We will need a longer wall when the revolution comes."
--- AJS, quoting an uncertain source.

Jürgen Exner 12-14-2011 12:25 PM

Re: Difference between my() and $var = false
 
Jason C <jwcarlton@gmail.com> wrote:
>Is there a technical difference between these two?
>
>my($var);
>$var = false;


Hmmmm, do they have anything in common?

jue


All times are GMT. The time now is 04:41 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.