The substitution below works for the sample provided, however this is the wrong way
to do it, I've assumed that this is very simple HTML with nothing that would break a very simple minded substitution. (eg, what would happen when a button with the alternative text "Next >" )
There is a famous response
to this on another site, but the Perl specific response is to use a HTML parsing module eg HTML::TokeParser::Simple
which helpfully has extracting the content from a html file as the first example.
print "Good ",qw(night morning afternoon evening)[(localtime)/6]," fellow monks."