MT2116 : Addons to the CSV Export
[koha.git] / test.pl
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 my $string = $ARGV[0];
7
8 # Getting the marcfields as an array
9     my @marcfieldsarray = split('\|', $string);
10
11     # Separating the marcfields from the the user-supplied headers
12     my @marcfields;
13     foreach (@marcfieldsarray) {
14         my @result = split('=', $_);
15         if (scalar(@result) == 2) {
16            push @marcfields, { header => $result[0], field => $result[1] }; 
17         } else {
18            push @marcfields, { field => $result[0] }
19         }
20     }
21
22 use Data::Dumper;
23 print Dumper(@marcfields);
24
25
26 foreach (@marcfields) {
27     print $_->{field};
28 }
29
30