my $last_digit = 5; if ($last_digit == substr $number, -1) { print "Matches!\n" }
Or, similarly, use rindex:
if (rindex($number, $last_digit) == length($number) - 1) { print "Matches!\n" }
In reply to Re: <digits match>
by choroba
in thread <digits match>
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |