#!/usr/local/bin/perl use strict; use warnings; use HTML::TokeParser::Simple; # load your html into a string my $content = do{local $/;}; my $p = HTML::TokeParser::Simple->new(\$content); while (my $t = $p->get_tag(q{input})){ my $name = $t->get_attr(q{name}); my ($token) = $name =~ /^org\.somescript\.html\.(.*)$/; print $token; # prints TOKEN } __DATA__