http://www.perlmonks.org?node_id=628235


in reply to Saving a Pattern Match from Subroutine

Without knowing too much about the problem, it looks like you want something like this:

my @files; foreach $inst (@instances) { my @junk = $inst->look_down( 'tag' => 'span', 'class' => 'inst', sub { my $result = $_[0]->look_down( '_tag' => 'a', 'href' => qr/(\w+\.html)#\w/)); push @files => $1 if $1; return $result; });

Of course, this falls into the "wild-assed guess" category. It seems straightforward enough that I'm wondering if I've misunderstood something.

Cheers,
Ovid

New address of my CGI Course.