while ( and !$flag){print;} error is: Use of uninitialized value $_ in print at C:\testwhile.pl line 8, line 1. while ($_= and !$flag){print;} error is: Value of construct can be "0"; test with defined() at C:\testwhile.pl line 6. while (defined($_=) and !$flag) no error