my @array2; push @array2, join(' - ', @{$_}) for sort {$$a[0]cmp$$b[0] || $$a[2]cmp$$b[2]} @array;