From: sfritz <[EMAIL PROTECTED]>
> having two
>
> my $name = "Sean Fritz";
> my $name = "Sean W. Fritz"; #functions as the shown assignment
> statment,
>
> just functions as an assignment statment (I believe) and dosen't
> alocate any memory or destroy the previous variable.
> my $a = $a;#refrences whatever was the scoped $a before
in the following paragraph I said global var, meant lexical. my bad =/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
There is no way to re-define the variable in perl. The $, @, and % all
have thier own seperate namespaces, and thus the definition
my $in;
my @in;#creates *both* a scalar and array
the best way is to
use warnings;#start of every program!
and it will give you a bit of ugly output to S
claration in same scope at C:\tmp\t.pl line 6.
hth,
jos
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: 28 January 2002 16:03
> To: [EMAIL PROTECTED]
> Subject: How to prevent redefining a variable with use strict?
>
>
>
way akin to this in Perl?
Thanks,
Rex
> -Original Message-
> From: John Edwards [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 28, 2002 11:13 AM
> To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
> Subject: RE: How to prevent redefining a variable with use str
ry 2002 16:03
To: [EMAIL PROTECTED]
Subject: How to prevent redefining a variable with use strict?
Friends,
When we use strict pragma, is there a way to "prevent" redefining a
variable?
use strict;
my ($i) = 5;# $i defined
print ("Val of i = $i");
my ($i)
Friends,
When we use strict pragma, is there a way to "prevent" redefining a
variable?
use strict;
my ($i) = 5;# $i defined
print ("Val of i = $i");
my ($i) = 6;# $i redefined?Could this be tagged as an
error?
print ("Val of i = $i");
Thanks,
Rex