in reply to Meta tag
But first you'll probably have to install the module of course. The example opens a local file and you'll have to adapt it to open a URL or a file handle, etc.use HTML::TokeParser::Simple; my $parser = HTML::TokeParser::Simple->new( 'foo.html' ) || die "$!"; while ( my $token = $parser->get_token() ) { if ( $token->is_tag( 'meta' ) && $token->get_attr( 'name' ) =~ /description/i ) { print $token->get_attr( 'content' ); } }
The example above will keep on processing the whole file, which is inefficient. On the other hand, what if you've got two META tags in the document? Do you need to know? Just add a "last" after the print if you don't care.
($_='kkvvttuu bbooppuuiiffss qqffssmm iibbddllffss')
=~y~b-v~a-z~s; print
|
|---|