(defun perl-sub (name) "Insert a new subroutine" (interactive "*sName: ") (insert "sub {\n\n\n\n}\n") (previous-line 4) (indent-for-tab-command) (insert "my () = @_;") (search-backward "sub ") (goto-char (match-end 0)) (insert name) (search-forward "("))