#!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.