http://www.perlmonks.org?node_id=59405
Category: Miscellaneous
Author/Contact Info clemburg
Description: Ever tried outline-mode in an emacs? It works with Perl, too. Just put this code into your .emacs, or execute it from buffer *scratch*. Then do M-x perl-outline-mode after you opened the Perl code file. You can then expand and contract subroutines (with C-c @ C-t to contract all, C-c @ C-a to expand all, C-c @ C-d to contract a function, C-c @ C-s to expand it).
(defun perl-outline-mode ()
  "set customized outline minor mode for Perl"
  (interactive)
  (setq outline-regexp "sub")
  (outline-minor-mode))

Update: This works even better:

(defun perl-outline-mode ()
  "set customized outline minor mode for Perl"
  (interactive)
  (setq outline-regexp 
    "#!.\\|\\(pac\\)kage\\|sub\\|\\(=he\\)ad\\|\\(=po\\)d")
  (outline-minor-mode))