in reply to Previous Line Matching Issues
On line 23 you have "my $pl = ''". You probably intend to use that variable to hold the "previous line." But it's never being set to anything within the while loop.
The standard algorithm is something like this:
my $prev; while( my $curr = <$infile> ) { chomp $curr; if( defined $prev && $curr eq $prev ) { # Take some action. } $prev = $curr; }
If you need to report the line number within the file of the contents of $prev, it's always going to be $.-1.
Dave
|
|---|