Owen wrote:
On Fri, 25 Feb 2005 15:55:21 -0700
"Bret Goodfellow" <[EMAIL PROTECTED]> wrote:

# while1.pl
use strict ;
use warnings ;

$i = 1;

while ($i < 10) {
print "I am at $i\n";
i++;
}
# while1.pl

Global symbol "$i" requires explicit package name at

Try removing the 'use strict;' statement. See what happens

Better put on your fire resistant flame suit, thats some pretty bad advice :)


You also have another problem with that script, perhaps i++ was a typo?

Exactly why you don't remove strict but fix the problem :)

#!/usr/bin/perl

use strict;
use warnings;

my $i = 1;  # problem one: use my()
while($i < 10) {
   print "I am $i hear me roar\n";
   $i++; # problem 2 $i not i
}

# or even sexxier :)

print "I am $_ hear me roar\n" for(1..9);

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to