#!/usr/local/bin/perl -l # use strict; use warnings; my $rxSplit = qr {(?x) (?<=[^<]) (?=[<]) | (?<=[>]) (?=[^<]) }; my $html = q{Startand moreand end}; my @elems = split m{$rxSplit}, $html; print for @elems; #### Start and more and end