Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Saving a Pattern Match from Subroutine

by Ovid (Cardinal)
on Jul 23, 2007 at 13:37 UTC ( #628235=note: print w/ replies, xml ) Need Help??


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.


Comment on Re: Saving a Pattern Match from Subroutine
Download Code
Re^2: Saving a Pattern Match from Subroutine
by shoness (Friar) on Jul 23, 2007 at 14:04 UTC
    Ack! Thanks Ovid!
    push @files => $1 if $1;
    Thanks to Corian as well for the Web::Scraper pointer.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://628235]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2015-07-06 16:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (77 votes), past polls