my @list = ; chomp @list; my $prev_line; for my $line (@list) { # Look at current line # remember this line as "previous" };