Hi Robin


 join_field("subject.*"," "); 

The first join is for concatenating all the subfields. The second join is for 
all the field.

In the new Catmandu version we are enhancing the language a bit, thats why I 
might have written my previous examples with the new syntax.

Greetings from ELAG2014 in Bath!

From: Robin Sheat [ro...@catalyst.net.nz]
Sent: Monday, June 09, 2014 4:58 AM
To: perl4lib
Subject: Re: Converting MARC fields with Catmandu - repeated subfields being 
squished together.

Robin Sheat schreef op ma 09-06-2014 om 14:50 [+1200]:
> $ cat test.fixes
> marc_map('650','subject',join:'###');
> remove_field('record');

Ah, I found that I need to change the syntax a bit:

marc_map('650','subject', -split => 1);

gives me:

{"subject":[["Counting","Pictorial works","Juvenile
literature."],["English language","Alphabet","Pictorial works","Juvenile
literature.","14467"],["Time","Pictorial works","Juvenile
literature.","15531"],["Children's stories, English","Pictorial

which is closer. Is there an easy way to flatten those arrays?

Otherwise I can go with join and the split, but this way seems cleaner.

Actually, I wonder if nested arrays would work even better for my
purposes, I guess I should test it...

Robin Sheat
Catalyst IT Ltd.
✆ +64 4 803 2204
GPG: 5FA7 4B49 1E4D CAA4 4C38  8505 77F5 B724 F871 3BDF

Reply via email to