in reply to <digits match>
my $last_digit = 5; if ($last_digit == substr $number, -1) { print "Matches!\n" } [download]
Or, similarly, use rindex:
if (rindex($number, $last_digit) == length($number) - 1) { print "Matches!\n" } [download]