$i = 0; while ($html =~ m/ # if $i > 1, do action to get rid of nested loop. }