in reply to pattern matching

I was able to come up with a working version with a much simpler regex. The regex matches just the if statement, then removes the next set of curly braces. One caveat though - it only removes braces for the first if statement. Subsequent ones would not be effected.
One thing you might keep in mind is that it's often a good idea to backslash '\' characters like braces if your using them in a non-grouping way in your regex. I tend to backslash all non-alphanumeric chars in my regexes, just to be safe.
#/usr/bin/perl -w use strict; my $data; while(<DATA>) {  last if ($_ eq "");  $data .= $_; } print $data; if ( $data =~ /if.*?\{/s ) { # New RegEx  $data =~ s/\{//;  $data =~ s/\}//; } print $data; __DATA__ if (c=e) {   //delete these curly braces  call pgme; call pgmd; } //delete these curly braces else {call pgmd; // keep these curly braces call pgmc;}

Output: if (c=e) //delete these curly braces call pgme; call pgmd; //delete these curly braces else {call pgmd; // keep these curly braces call pgmc;}

Rich36
There's more than one way to screw it up...