
zOrK
Novice
Jul 26, 2007, 11:09 PM
Views: 1918
|
|
Re: [Regent] Trying to get meta tags
|
|
|
try #!/usr/bin/perl use strict; use HTML::TokeParser; sub get_description { my $content; my $p = HTML::TokeParser->new($_[0]); while ( my $tag = $p->get_tag("meta") ) { if ( defined( $tag->[1]{'name'} )) { if($tag->[1]{'name'} eq "description") { $content = $tag->[1]{'content'} } }; } print "$content\n"; } get_description("index.html"); You need http://search.cpan.org/CPAN/authors/id/G/GA/GAAS/HTML-Parser-3.56.tar.gz --------- You may also find Perl information on my blog: http://www.ferry.cl/carlos/
(This post was edited by zOrK on Jul 26, 2007, 11:10 PM)
|