---
name: "Catmandu::Fix::marc_add"
section: "3pm"
platform: "linux"
package: "libcatmandu-marc-perl"
version: "1.320-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Catmandu::Fix::marc_add"
---

# Catmandu::Fix::marc\_add(3pm)

add new fields to marc

## NAME

Catmandu::Fix::marc\_add - add new fields to marc

## SYNOPSIS

```
    # Set literal values
    marc_add('900', a, 'test' , 'b', test)
    marc_add('900', ind1 , ' ' , a, 'test' , 'b', test)
    marc_add('900', ind1 , ' ' , a, 'test' , 'b', test)
    # Set control fields
    marc_add('009','_','23123131')
    # Copy data from an other field (when the field value is an array, the
    # subfield will be repeated)
    marc_add('900', a, '$.my.data.field')
```

## DESCRIPTION

Add a new subfield to MARC record.

## METHODS

### marc\_add(MARC\_FIELD, SUBFIELD, VALUE, \[ SUBFIELD, VALUE , ... \])

Add new subfields to a MARC record. The MARC\_FIELD should contain a marc field name, all other arguments contain the subfields to be added.

By default literal values will be added. To point to an existing value in a record use the JSON\_PATH syntax with a dollar '$.' added in front.

## INLINE

This Fix can be used inline in a Perl script:

```
    use Catmandu::Fix::marc_add as => 'marc_add';
    my $data = { record => [...] };
    $data = marc_add($data,'245','a','title');
```

## SEE ALSO

Catmandu::Fix::marc\_set, Catmandu::Fix::marc\_copy, Catmandu::Fix::marc\_cut, Catmandu::Fix::marc\_paste
