in reply to hash unorderly output

I think that the OP might be expecting that keys %grp_advice always return ("grp1","grp2","grp3") in that order because that is how the hash was declared, but it will not. From perldoc -f keys section of perlfunc:
keys HASH
  Returns a list consisting of all the keys of the named hash. (In
  scalar context, returns the number of keys.) The keys are
  returned in an apparently random order. The actual random order
  is subject to change in future versions of perl, but it is
  guaranteed to be the same order as either the "values" or "each"
  function produces (given that the hash has not been modified).
  As a side effect, it resets HASH's iterator.