Ugly is right. That's totally unreadable (read as "unmaintainable") because you use nonsense names.
- Why not call $n $last_bowler?
- Why not call $m $last_game?
- Why not call $l $bowler_num?
- Why not call $o $game_num?
- Why not call $i $bowler_idx?
- Why not call $j $game_idx?
- Why not call $k $bowler_idx?
- $k and $i have the same purpose, so why don't they have the same name?
- Where is use strict;?
- Where is use warnings;?
- Why undef $k; instead of $k = 0;? It works, but it's weird, since you're relying on undef being equal to 0.
- Why are your mys so far away from where the variable is used? for my $i (...) { ... } would limit the scope of $i to that loop.