in reply to can someone plz decode this sort for me?

The items from @allgs (which would appear to be numbers) will be sorted according to their associated value in the hash %g2o (compared as string), or, if equal, the smallest value (as a number) comes first.

For example:

%g2o = ( 128 => 'a', 13 => 'b', 34 => 'a', 28 => 'c' ); @allgs = (128, 13, 34 ); @allgsplane = sort { ($g2o{$a} cmp $g2o{$b}) || ($a <=> $b) } @allgs; print "@allgsplane\n";
prints
34 128 13
All items with the value 'a' in the hash (34, 128) come before the item with value 'b' (13), because 'a' comes before 'b', but since there are two items with 'a', the smaller one (34) comes before the larger one (128).

Note that my hash contains more items than the list I'm sorting, but those will simply be ignored.

If the hash contains fewer items than the list, then it'll still work, with the missing items getting a default value of 0 (actually undef, but numerically, that is 0), but with "use of unitialized value" warnings.