为什么我的($ i)索引不起作用?

-1 indexing perl

我的节目是

#!\usr\bin\perl -w

my @one= ("sun", "moon", "star");
my $three="SON"; 
my $flag= 0;
my $tester_1=0 ; 
my $tester_2= 0;
my $i= 0;

push (@one, $three);

print @one; 
print join(" ", @one);

while (@one[$i]= $three) 
{
    #flag 1
    if (@one[$i] ne "moon"&& @one[$i] ne "star") 
    {
        $tester_1= 1; 
    }

    ##flag2 
    if ($i<= 99) 
    {
        $tester_2=1;
    }

    #real condition 
    if ($tester_1= 1)
    { 
        if ($tester_2= 1)   
        {
            print @one[$i];
            $i++; 
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我运行我的程序.循环运行无限次.在标志2中,我设置了$ i <= 99;的条件,因此根据我打印第100个SON后我的程序应该停止.但是,由于某些原因,$ i <= 99无效?是什么原因?

yst*_*sth 6

您显示已启用警告; 您的代码会生成警告. 修复它们,你将解决你的问题.如果您无法理解警告,请尝试添加use diagnostics;