in reply to why is my for loop using modulo giving me a weird output

In Perl your for loop is better written:

for my $count (0 .. 20) { ... }
Perl is the programming world's equivalent of English