Building a Parser: Actions 

$::RD_AUTOACTION = q { 
    my $text = join " ", 
               map {ref $_ eq 'HASH'  ? $_->{text}   : $_} 
               map {ref $_ eq 'ARRAY' ? @$_          : $_}
                   @item[1 .. $#item];
    my $record = {
               map {ref $_ eq 'HASH'  ? %{$_->{record}} : ()} 
               map {ref $_ eq 'ARRAY' ? @$_          : $_} 
                   @item[1 .. $#item] };
    if (_is_field($item[0]) or $item[0] eq 'remaining') {
        $record->{$item[0]} = $text 
    }
    $return = { text => $text, record => $record };
};