Re: same variable defined twice

[email protected] ("R. Hicks")
Newsgroups perl.beginners
Message-ID <[email protected]>
Octavian Rasnita wrote:
> Hi,
> 
> I've tried the following script and it works fine:
> 
> use strict;
> my $text = 1;
> my $text = 2;
> print $text;
> 
> Shouldn't perl disallow defining the $text variable a second time in the same script if using "use strict"?
> 
> Thank you.
> 
> Octavian
> 
I just ran into this:

my $limit = '';
$limit = ' LIMIT 10';

In development it takes the second one...and it can be commented out so 
the first hit gets taken. Other ways to do it, of course, but this is a 
one-time script. I wouldn't do that in a larger program.

R
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.