#!usr/bin/perl use strict; use warnings; while (my $line = and $line !~ /^\s*$/) { print "do somehing with non blank line\n"; } __END__ Value of construct can be "0"; test with defined() at C:\Users\mmtho\Documents\PerlProjects\Monks\test_myVar_inwhile.pl line 5. Global symbol "$line" requires explicit package name (did you forget to declare "my $line"?) at C:\Users\mmtho\Documents\PerlProjects\Monks\test_myVar_inwhile.pl line 5. Execution of C:\Users\mmtho\Documents\PerlProjects\Monks\test_myVar_inwhile.pl aborted due to compilation errors. #### #!usr/bin/perl use strict; use warnings; while (defined (my $line =) and $line !~ /^\s*$/) { print "do somehing with non blank line\n"; } __END__ Global symbol "$line" requires explicit package name (did you forget to declare "my $line"?) at C:\Users\mmtho\Documents\PerlProjects\Monks\test_myVar_inwhile_ver2.pl line 6. Execution of C:\Users\mmtho\Documents\PerlProjects\Monks\test_myVar_inwhile_ver2.pl aborted due to compilation errors. #### #!usr/bin/perl use strict; use warnings; my $line; while ($line = and $line !~ /^\s*$/) { print "do somehing with non blank line\n"; } __END__ Value of construct can be "0"; test with defined() at C:\Users\mmtho\Documents\PerlProjects\Monks\test_myVar_inwhile_ver2.pl line 7. do somehing with non blank line do somehing with non blank line #### #!usr/bin/perl use strict; use warnings; my $line; while (defined($line =) and $line !~ /^\s*$/) { print "do somehing with non blank line\n"; } __END__ do somehing with non blank line do somehing with non blank line do somehing with non blank line do somehing with non blank line