in reply to sed in perl script

Perhaps the perldoc for s2p (sed-to-Perl) would give you a quick intro to Perl, by translating your sed commands.