my $ip = $list->index("T$j.first") || '1.0'; #preserve insertion point #if insertion point is not found, then use 1.0 as insertion point. $list->delete("T$j.start", "T$j.last"); $list->insert($ip, "next text here"); #### foreach my $i ($list->tagNames()) { if ($i eq $j) { print "$tag found\n"; last; } }