sub except (&;$) { my $code = shift; my $clauses = shift || {}; my $catch = $clauses->{'catch'} ||= []; my $sub = sub { my $ref; my(@array) = $code->($_[0]); if(@array == 1 && ref($array[0])) { $ref = $array[0]; $ref = [ %$ref ] if(UNIVERSAL::isa($ref,'HASH')); } else { $ref = \@array; } @$ref }; unshift @{$catch}, undef, $code; $clauses; }