#!/usr/bin/perl -w use strict; #examine DATA as a single string. $/ = ''; while (){ #'.' will match \n with the /s operator if ( m/if.+else/s ){ s/{//; s/}//; } print; } __END__ if (c=e) { #// delete this curly brace call pgme; call pgmd; } else { call pgmd; #// keep these curly braces call pgmc; } if (c=e) { #// delete this curly brace call pgme; call pgmd; } else { call pgmd; #// keep these curly braces call pgmc; }