sub flatten { return unless @_; my $val = shift; return flatten(@$val, @_) if UNIVERSAL::isa($val, 'ARRAY'); return $val, flatten(@_); }