TokeParser problems - grab http-equiv ???

This works fine! It always grabs the $name and $content of the
Meta tags just like it's supposed too!
$name = "Author";
$content = "John Doe";

          while (my $token=$parser->get_tag("meta"))
            $name=$token->[1]{name};          # grabs name here
            $content=$token->[1]{content};     # grabs content here

The following doesn't work! How do I grab the HTTP-EQUIV name ?
It always returns blank "" for $name.  I've tried using capitals, etc...

          while (my $token=$parser->get_tag("meta"))
            $name=$token->[1]{http-equiv};     # cant grab this
            $content=$token->[1]{content};       # grabs content here

$content="what it should be";

Also, how would I make it grab ANY tags within Meta?  There are some real weird ones (like dublin core).  Anyone got any code for this?  P.S.  You don't have to answer this last part!
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

clockwatcherConnect With a Mentor Commented:
The '-' sign is throwing you off.  Try this and I think you'll have better luck:


To list all the tags within a meta simply iterate through the keys:

use LWP::Simple;
use HTML::TokeParser;

$page = qq(
<meta http-equiv="refresh" content="1,">
<meta name="author" content="me">
<meta name="keyword" content="perl,tokeparser">
<meta HTTP-EQUIV="content-type" content="text/html">
<meta whatever="something" what-about-this="sure">

$parser = HTML::TokeParser->new(\$page);

while (my $token=$parser->get_tag("meta"))
    foreach (sort keys %{$token->[1]}) {
      print "$_ : $token->[1]{$_}\n";
    print "\n\n";


jgoreAuthor Commented:
Thanks ClockWatcher!
All Courses

From novice to tech pro — start learning today.