Hello,
I need a way to check to see if there is a blank line in a text document being read. Below is the code I have at the moment but it doesn't seem to be working. Any suggestions?
Also should I be using the "last" statement to break out of the while loo. As you can see I'm quite new to PERL.
I need a way to check to see if there is a blank line in a text document being read. Below is the code I have at the moment but it doesn't seem to be working. Any suggestions?
Also should I be using the "last" statement to break out of the while loo. As you can see I'm quite new to PERL.
Code:
use strict;
#print "$ARGV[0]";
open(MY_FILE1,$ARGV[0]);
while(<MY_FILE1>)
{
chomp;
my $line1 = $_;
open(MY_FILE2,$ARGV[1]);
while(<MY_FILE2>)
{
my $line2 = $_;
if ($line2 eq "")
{
print "Empty Line";
last;
}
else
{
print ("$line1 $line2");
}
}
close MY_FILE2;
}
close MY_FILE1;
close MY_FILE2;