my $text = '/export/home33082183072003082247.­0 days000-'; $text =~ s!<[^>]+>!^!g; # replacing tags with caret my @data = split(/\^/, $text); # splitting at caret my @data = grep {$_} @data; # remove undef elements print join(" : ", @data); __END__ /export/home3 : 308218 : 307200 : 308224 : 7.­0 days : -