$moduloc = () = $compare =~ /X(\d+):/; # Grab the divisor. $moduloe = () = $element =~ /X(\d+):/; # Grab the other one. next if ( not $modulo ); # otherwise zero always matches. if ( not ($moduloe)%($moduloc) ) { # Do something. }