my $text = $t->get("1.0", "end"); foreach my $line (split /\n/, $text) { #### for (split /\n/, $text) { if (/\b$string\b/) {