perl -e 's/^#(.*)$/$1/ if /\bDEBUG\b/../\bENDDEBUG\b/' foo.pl | perl