my @sorted = sort { $a->{$foo}[$bar] <=> $b->{$foo}[$bar] } @raw_data;