#!/usr/bin/perl use strict; use warnings; my $first_try; my $commented_out = <## if (0) { # lots of code here that I don't want to use just now... } #### # this part is currently runnable: my $foo = "bar\n"; =head2 Commented out my $baz = "blah"; # lots more code that I don't want to use right now... =cut # this part is also currently runnable... print $foo; #### perl -i.bak -pe '$_="# $_" if($.>=10 and $.<=20)' myscript.pl #### perl -i.bak -pe '$_="# $_" if(/^\$foo =/../^\$bar =/)' myscript.pl