I don't know if anyone noticed, but in the sample file given, there was a space between the last word and the bracketed br in the first line, and no space in the second. I don't know if it was a typo, or if it was an intentional fine point. In any event, it screwed up the spilt on space to array, giving 1 extra element.
There may be a clever regex to do this, but here is a simple way a beginner can understand.
#!/usr/bin/perl
use warnings;
use strict;
open (my $fh, "< test.txt") or die "$!\n"; #input file
open (my $oh, "> $0-out.txt") or die "$!\n"; #output file
my $script = '/home/whoever/bin/myscript.pl';
while (<$fh>){
my $string = $_;
# strip off trailing <br> and anything after it
$string =~ s/<br>.*$//;
#strip whitespace at end in case space preceded the <br>
$string =~ s/\s+$//;
## split on space
my @words = split / /, $string;
#print join "\n",@words,"\n";
my $lastword = $words[-1];
print $oh "$script $lastword\n";
}