in reply to use strict and TokeParser
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: use strict and TokeParser
by PodMaster (Abbot) on Nov 24, 2004 at 08:04 UTC | |
by Ovid (Cardinal) on Nov 24, 2004 at 12:56 UTC | |
by PodMaster (Abbot) on Jun 02, 2005 at 12:22 UTC | |
by Ovid (Cardinal) on Jun 03, 2005 at 15:39 UTC | |
by runrig (Abbot) on Jun 03, 2005 at 18:32 UTC | |
by Ovid (Cardinal) on Nov 24, 2004 at 22:40 UTC |