You can make this easier and avoid those types of errors by switching to HTML::TokeParser::Simple and some defensive programming (it's easier to read, too.)
use strict; use HTML::TokeParser::Simple; my $filepath = "c:/folder/file.html"; my $stream = HTML::TokeParser::Simple->new($filepath) or die $!; while (my $token = $stream->get_token){ next unless $token->is_start_tag('a'); print "PDF link!\n" if $token->get_attr('href') =~ m/\.pdf/; }
Cheers,
Ovid
New address of my CGI Course.
In reply to Re: use strict and TokeParser
by Ovid
in thread use strict and TokeParser
by young_stu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |