my $last_digit = 5; if ($last_digit == substr $number, -1) { print "Matches!\n" }