sub rev_arr { my $arr_ref = shift; @$arr_ref = map { ref eq 'ARRAY' ? rev_arr($_) : $_ } reverse @$arr_ref; return $arr_ref; }