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