#!/usr/bin/perl use warnings; use strict; use HTML::TokeParser::Simple; my $html = do{local $/;}; my $p = HTML::TokeParser::Simple->new(string => $html); my ($in_td, $in_b); while (my $t = $p->get_token) { $in_td++, next if $t->is_start_tag(q{td}); $in_b++, next if $in_td and $t->is_start_tag(q{b}); next unless $in_td and $in_b; if ($t->is_text){ print $t->as_is, qq{\n}; $in_td = 0; $in_b = 0; } } __DATA__ hsa-miR-107 17.1922 -21.47 2.119850e-02 2.097540e-02 6.191350e-04 106 127
acu


  hsa-miR-103
  17.1922

  hsa-miR-651
  

  hsa-miR-320

####

hsa-miR-107
hsa-miR-103
hsa-miR-651
hsa-miR-320