sub rev_arr { my $ar = shift; ref $ar eq 'ARRAY' ? [ map rev_arr($_), reverse @$ar ] : $_ }