in reply to finding multiples of two values

What's that subroutine have to do with checking whether two numbers are multiples of each other? Just use the modulo operator (%), see the perlop manual page.