You might be interested in Tie::Array::Sorted which keeps the array sorted while you add things to it.
However, using autovivication won't work: if the array for a certain key doesn't exist yet, you'll have to create the tied array first (unless there's a clever trick I don't know).
Hope this helps, -gjb-
In reply to Re: sort while push in hash
by gjb
in thread sort while push in hash
by Murcia
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |