John, Thanks for your input. However, what I was expecting was to have variables that are scoped properly without being accidentally redefined within the same scope. Using constants would prevent the "redefining" problem, nonetheless they would not allow me to alter the values either!
In VBScript, <script language="vbscript"> dim count : count = 0 msgbox(count) count = count + 1 dim count : count = 0 msgbox(count) </script> That would tag the second dim statement to be erroneous ("Name Redefined Error"), thereby prohibiting redefinition of a variable! I am seeking a clarification as to whether there a 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 strict? > > > You could use a constant instead. > > -- code -- > > use strict; > use constant INDEX => 5; # I'm assuming $i refers to an > index. Use more > descriptive variable names... > > print ("Value of index" . INDEX . "\n"); > > INDEX = 6; > > -- end code -- > > Run that and you will get the following error. > > Can't modify constant item in scalar assignment at test.pl > line 6, near "6;" > Execution of test.pl aborted due to compilation errors. > > Remove that line and it will work. > > HTH > > John > > >