in reply to trim the blank lines...regex

Have a look at s/// in Regexp Quote Like Operators in perlop