Depending what appears more natural to you, you can also check this as
if $i < $#$ordered_list;
In reply to Re^2: Array mysteriously growing by pKai in thread Array mysteriously growing by AntsPants