Koha/test.pl
Matthias Meusburger a404384b11 MT2116: Addons to the CSV export
Add user-defined headers
Add CSV, field and subfield separator selection
2010-01-28 15:11:54 +01:00

30 lines
574 B
Perl

#!/usr/bin/perl
use strict;
use warnings;
my $string = $ARGV[0];
# Getting the marcfields as an array
my @marcfieldsarray = split('\|', $string);
# Separating the marcfields from the the user-supplied headers
my @marcfields;
foreach (@marcfieldsarray) {
my @result = split('=', $_);
if (scalar(@result) == 2) {
push @marcfields, { header => $result[0], field => $result[1] };
} else {
push @marcfields, { field => $result[0] }
}
}
use Data::Dumper;
print Dumper(@marcfields);
foreach (@marcfields) {
print $_->{field};
}