Please avoid using $a and $b as general purpose variables. They are "magic" variables used by sort.
In reply to Re^2: Array question by GrandFather in thread Array question by udinakar