#!/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; #### ---------- Capture Output ---------- > "C:\Perl\bin\perl.exe" _new.pl Start and more and end > Terminated with exit code 0.