in reply to Perl modulus not working

FYI, it is customary to print status-messages to STDERR when output goes to STDOUT.   Output buffering can sometimes also be a consideration (in other contexts).