D
dima
Hello all!
The following code is correct :
open(FD,"< my.txt") or die("Error");
while(<FD>)
{
print "$_\n";
exit(0) if ($_eq "STOP");
}
But this code work incorrect :
open(FD,"< my.txt") or die("Error");
$_="NOT_STOP";
while(<FD> and ($_ne "STOP") )
{
print "$_\n";
}
print "$_\n";
exit(0);
Both example are equivalent? Or I wrong?
Furthermore, why this code is incorrect :
while(<FD> and 1)
{
print "$_\n";
}
Thanks!
The following code is correct :
open(FD,"< my.txt") or die("Error");
while(<FD>)
{
print "$_\n";
exit(0) if ($_eq "STOP");
}
But this code work incorrect :
open(FD,"< my.txt") or die("Error");
$_="NOT_STOP";
while(<FD> and ($_ne "STOP") )
{
print "$_\n";
}
print "$_\n";
exit(0);
Both example are equivalent? Or I wrong?
Furthermore, why this code is incorrect :
while(<FD> and 1)
{
print "$_\n";
}
Thanks!