Some of the other postings give solutions that are more accessible to a beginner, but I would like to present one that demonstrates some possibilities that are available with more advanced knowledge. If the coding looks too complicated to debug and maintain, you might still be able to mine it for some ideas.
Update: based on suggestion in reply from haukex coding now does defined test instead of relying on minimum number. I realize that I have been using the technique of creating variables in a conditional (if ... defined ...) for years without really understanding it, until I came across a posting here and read through related discussion. It may be a bit more advanced than I originally thought but ok fit for the revised solution. Satisfied with the brevity of the result but wish it was less complicated. I learned from working on and revising the code, and hope at least a few readers can learn something useful as well.
#!/usr/bin/perl -n
######################################################################
# Solution requires more advanced knowledge of Perl technology
# but leverages "off the shelf" technology and components
# for a hopefully short and robust solution.
#
# -n command line switch provides loop to read file
# Number parsing and max number on line come from common
# Perl modules.
######################################################################
#
# I am being forced to work under threat and duress
# and had to remove this. Sorry. Hopefully I can put
# it back some day?
#
# Still afraid of eviction. Harassment at every meal.
# Very useful article of clothing seems to have been
# stolen day I had to remove code.
#
Invocation:
ron@penguin:~/monk-bus/line-w-high-no$ ./high-line.pl <in-data.txt
1 this year is 2019 1