use strict; my $lstlisting=0; while (<>) { my $line = $_; if (m/%DIFDELCMD\s+<\s+\\begin\{lstlisting\}/) { $lstlisting=1; $line =~s/%DIFDELCMD\s+