in reply to sorting an array mix

use Sort::Naturally or Sort::Key::Natural or
my @b = sort { substr($a, 2) <=> substr($b, 2) } @g;