in reply to pattern matching

I think the immediate problem is that curlies are re metas. Escape them as:

if ( /if.*?\{/s .. /.*?\}.*?else/s ) { $_ =~ s/\{//; $_ =~ s/\}//; }
That's not the only problem, though. Consider the result of applying that to:
if (c=e) { call pgme; call pgmd; } if (c=d) { call pgmd; call pgme; } else { call pgmd; call pgmc; }
You may get some use of Text::Balanced.

Update: Added s switch to matching, ++dmmiller2k.

After Compline,
Zaxo