{ push @next, $p->get_token(); if ($next[1][0] eq 'T') { my $title= $next[1][1]; #strip white space from title and get up to four words if ($title =~ /(\w+)\s*(\w+)\s*(\w+)\s*(\w+)/) { my $filetitle = $1 . $2 . $3 . $4; my $newsrc = $filetitle . "\.jpg"; while ( $token=$p->get_token() ) { if ($token->is_start_tag('img') ) { my $src = $token->return_attr->{src}; $token->set_attr('src', $newsrc); } print FILE $token->as_is; } }}}