in reply to Script (ovid's) explanation

'->' is the dereference operator.
$foo->[0] is dereferencing an arrayref $foo->{bar} is dereferencing a hashref $foo->(@blah) is dereferencing (and invoking) a function-ref $foo->bar is calling the method "bar" that is defined in the class tha +t $foo has been [bless]'ed into.
The first line you don't understand is creating a new instance of the class HTML::TokeParser. new() is, by common convention, the method that returns a new instance of a class.

The second line is an if-else statement. It can be rewritten as such:

my $text_index; if ($token->[0] eq 'T') { $text_index = 1; } else { $text_index = -1; }
Once you understand that $token->[0] is treating $token as a reference to an array and is getting the zero-th element, the other two parts shouldn't be that hard.

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.