# Perl Weekly Challenge 142: Divisor Last Digit

by Abigail

## Challenge

You are given positive integers, $m and $n.

Write a script to find total count of divisors of $m having last digit $n.

## Discussion

Given the first task of last week, this is very boring. Last week, we were asked to find the divisors of numbers, and report those who had 8 divisors. The week before we also had a task which we solved by finding the divisors.

Hence, this week, we just give a minimal Perl solution, and won't bother copy-and-pasting code for other languages.

## Solution

### Perl

perl -MMath::Prime::Util=divisors -pale '$_ = grep {/$F[1]$/} divisors$F[0]'


We read pairs of numbers from standard input, find the divisors of the first number ($F[0]), filter those ending in the second number ($F[1]), and print the amount (-p cause perl to print the content of \$_).

Find the full program on GitHub.