sub get_content { my $n = shift; my $content = qq( blah ); $content=~s{(?:^[\n\r]\s{4}|[\n\r]+\s{4})(.*)}{$1\n}gm; return $content; }