use Regexp::Common qw( comment ); local $/ = undef; $_ = ; s/$RE{comment}{C}//gs; print; __DATA__ /*This is the file which is used for the developing the code for multiple IO operation Author : Grey*/int myfunc();/* remove */ void main(); /*This is another comment */ void main() { int a, b; int d; //This is the temp copy buffer. /* This breaks regex solutions a = 10; b = 11;//This is the temp value assigned to the variables c = a+b; d = c+1; /*I am copying this with a increment*/ }