in reply to Can I use backreferences as quantifiers in a regex?

Yes, e.g.
'4hhhh' =~ /(\d)(??{ "h{$1}"})/