in reply to Stupid, yet simple, sort question

This ought do the trick -
foreach $loc (reverse sort { int(${$a}{online}) <=> int(${$b}{online}) + } @locations)

HTH

broquaint

Update: And if I look the at code a little closer, it may even work (dereferenced the info we want, thanks davorg)