Hi, Bret You must tell perl what kinds of var the $i is, when 'use strict'. $i can be a lexical var or a global var.
my $i = 1; # $i is a lexical var. our $i = 1; # $i is a global var, perl 5.6+ only. use vars qw($i); # also as global var, but can work under old perl 在 2005-02-25 15:55:00 您写道: >I'm getting the following error in my code. If I define $i as my $i >then everything works fine. What's wrong? > ># 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 >C:\BegPerl\while1.pl line 6 致 礼! Xiaofang Zhou [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>