if you also run under -w or do a 'use warnings' it will give you a warning if 
you're doing something like that.

consider this:

use strict;
use warnings;

my $i = 'foo';
my $i = 'bar';


will print to stderr with:
"my" variable $i masks earlier declaration 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?
> 
> 
> 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
> 
> 
> --------------------------Confidentiality--------------------------.
> This E-mail is confidential.  It should not be read, copied, disclosed
> or
> used by any person other than the intended recipient.  Unauthorised use,
> disclosure or copying by whatever medium is strictly prohibited and may
> be
> unlawful.  If you have received this E-mail in error please contact the
> sender immediately and delete the E-mail from your system.
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to