Localizing variables

2002-11-05 Thread Jason Frisvold
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 trying to do is create a temporary variable wit

Re: Localizing variables

2002-11-05 Thread Jenda Krynicky
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

RE: Localizing variables

2002-11-05 Thread Nikola Janceski
, 2002 4:43 PM > To: [EMAIL 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 = "

RE: Localizing variables

2002-11-05 Thread Jason Frisvold
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}. -- ---