in reply to funky $_ with map {}

$_ is a global, not a lexical, and doesn't "stay shared" in a lexically scoped sub ("closure"). You can solve it by using eval:
map { $_ => eval "sub { '<H1>$_</H1>' }" } 1..5
Don't be fooled by the single quotes: they are within a double quoted string that is passed to eval.

Lbh ebgngrq guvf grkg naq abj lbh pna ernq vg. Fb jung? :) -- Whreq