#!usr/bin/perl
use strict;
use warnings;
while (my $line =<DATA> and $line !~ /^\s*$/)
{
print "do somehing with non blank line\n";
}
__END__
Value of <HANDLE> construct can be "0"; test with defined() at C:\User
+s\mmtho\Documents\PerlProjects\Monks\test_myVar_inwhile.pl line 5.
Global symbol "$line" requires explicit package name (did you forget t
+o 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_in
+while.pl aborted due to compilation errors.
To fix the first error message,...
#!usr/bin/perl
use strict;
use warnings;
while (defined (my $line =<DATA>) and $line !~ /^\s*$/)
{
print "do somehing with non blank line\n";
}
__END__
Global symbol "$line" requires explicit package name (did you forget t
+o 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_in
+while_ver2.pl aborted due to compilation errors.
Back up and fix just this error message...
#!usr/bin/perl
use strict;
use warnings;
my $line;
while ($line =<DATA> and $line !~ /^\s*$/)
{
print "do somehing with non blank line\n";
}
__END__
Value of <HANDLE> construct can be "0"; test with defined() at C:\User
+s\mmtho\Documents\PerlProjects\Monks\test_myVar_inwhile_ver2.pl line
+7.
do somehing with non blank line
do somehing with non blank line
To make this work completely:
#!usr/bin/perl
use strict;
use warnings;
my $line;
while (defined($line =<DATA>) 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
|