http://www.perlmonks.org?node_id=538044


in reply to meta tag extraction with TokeParser

next if $token->[1] ne 'meta' && $token->[0] ne 'S'; $meta{$token->[2]{name}} = $token->[2]{content};
If you're seeing warnings about an 'uninitialized value', you should check if $token->[x] exists and is defined before comparing it to a different value or following the alleged reference.

Replies are listed 'Best First'.
Re^2: meta tag extraction with TokeParser
by Anonymous Monk on Mar 20, 2006 at 21:44 UTC
    I tried adding the following but it didn't change
    if ($token->[2] ne '') { $meta{$token->[2]{name}} = $token->[2]{content}; }
      Again, you're not checking if it's defined. Use this instead:
      if( defined $token->[2] ) { ... }
        After posting, I actually tried that instead and that, too, still produces the same results.