No worries asking vim (or Emacs) questions related to Perl. If it's about Perl, you're loved. If it's about vi(m) you're also loved. If it's about Emacs, some will love you ;)
I've never thought about wrapping output before. I wrap my subs in the following way in my .vimrc.
function GetPerlFold()
if getline(v:lnum) =~ '^\s*sub\s'
return ">1"
elseif getline(v:lnum) =~ '\}\s*$'
let my_perlnum = v:lnum
let my_perlmax = line("$")
while (1)
let my_perlnum = my_perlnum + 1
if my_perlnum > my_perlmax
return "<1"
endif
let my_perldata = getline(my_perlnum)
if my_perldata =~ '^\s*\(\#.*\)\?$'
" do nothing
elseif my_perldata =~ '^\s*sub\s'
return "<1"
else
return "="
endif
endwhile
else
return "="
endif
endfunction
setlocal foldexpr=GetPerlFold()
setlocal foldmethod=expr
I'm very curious to find out how this ends up. Never thought of having folds in a dumper output before.
Please supply an example output so that there's something to test/work with. Preferably, within your OP so that everyone has a chance to see it.