the following code finds the oldest value in the hast table test with the following format.
//hadd test date.pball $ctime
Just call the alias and it echos the oldest item and then deletes it
Code:
alias oldest {
  set -l %num 1
  set -l %oldest $ctime
  while ($hget(test,%num).data) {
    if ($hget(test,%num).data < %oldest) { set -l %oldest $v1 | set -l %item $hget(test,%num).item }
    inc %num
  }
  echo -a %item
  hdel test %item
}


warning this could take a while with 1000 entries and you could call it like if ($hget(test,0).item == 1000) oldest


http://scripting.pball.win
My personal site with some scripts I've released.