template/perl.pl and perl-inplace.pl modified and test cases updated