#!/usr/bin/perl use strict; use warnings; use HTML::TokeParser::Simple; my $str = q{Startand moreand end}; my $p = HTML::TokeParser::Simple->new(\$str) or die "can't parse str: $!"; my @array; while (my $t = $p->get_token){ push @array, $t->as_is; } print "$_\n" for @array;