This is an autovivication trap. Perl autovivifies (creates) missing elements of refrences for hash and array refs, so every time you get $eventscores->[$i]->[2] you'll at least get something, either your desired variable or undef. So if you overrun your array before you run out of data $rider_id will get set to undef and then the inner loop will become infinite because the autovivified undef's will of course be equal to undef.
While perl will handle most bounds checking for you this is one situation you have to do it yourself.