I looked up a few answers dealing with this warning, but neither did they help me, nor do I truly understand what Perl is doing here at all. Here\'s what I WANT it to do:
You need to have an anonymous subroutine to capture variables:
my $innerSub = sub { my $resultVar = doStuffWith($dom); return $resultVar; };
Example:
sub test { my $s = shift; my $f = sub { return $s x 2; }; print $f->(), "\n"; $s = "543"; print $f->(), "\n"; } test("a1b");
Gives:
a1ba1b 543543