in reply to Passing additional arguments to XML::Twig handlers
my $greeting = "hi"; my $my_s = sub { my ($twig, $section) = @_; print $greeting || "Hello" , ", ", $section->text(), "!\n"; }
You can then pass the closure in $my_s just like a normal reference to a sub.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Passing additional arguments to XML::Twig handlers
by pseudomonas (Monk) on Jan 29, 2008 at 14:47 UTC |