You are correct that the special variable
$_ will sequentially contain each line of the file as you move through. These lines will be scalar strings. When a scalar is used in
numeric context, Perl will attempt to convert that scalar into a number. If the leading non-whitespace characters look like a number (e.g.
' 56th finisher'), you will get a non-zero result (56 in this case).