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.
In reply to Re^2: Link Parser, something to be desired?
by ikegami
in thread Link Parser, something to be desired?
by koolgirl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |