From: Jason Frisvold [EMAIL PROTECTED]
I'm curious if there are any side effects to doing the following :
#!/usr/bin/perl
use strict;
use warnings;
my $var1 = test1;
my $var2 = this is not test2;
{
my $var2 = test2;
print $var1 - $var2\n;
}
print $var1 - $var2\n;
What I'm
PROTECTED]
Subject: Localizing variables
I'm curious if there are any side effects to doing the following :
#!/usr/bin/perl
use strict;
use warnings;
my $var1 = test1;
my $var2 = this is not test2;
{
my $var2 = test2;
print $var1 - $var2\n;
}
print $var1 - $var2\n
That is exactly what I was hoping...
Thanks!
On Tue, 2002-11-05 at 16:48, Nikola Janceski wrote:
the second 'my $var2' will have memory allocated to it, but will not be
freed until Perl ends, but Perl will re-use that memory allocation after
leaving the {BLOCK}.
--