Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Link Parser, something to be desired?

by ikegami (Patriarch)
on May 29, 2009 at 23:32 UTC ( [id://766983]=note: print w/replies, xml ) Need Help??


in reply to Re: Link Parser, something to be desired?
in thread Link Parser, something to be desired?

Escapes within double quotes can be tricky.

qr// makes it easy.

$regex = qr/href\s*=\s*".*?"/;

Also,
while ($line =~ /$regex/) { my $match = $&; ... }
can be better written as
while (my ($match) = $line =~ /($regex)/) { ... }
since it avoids globals and $&, which slows down matches throughout your program.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-20 01:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found