Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- use strict;
- use warnings;
- #use diagnostics;
- use utf8;
- require 'dumpvar.pl';
- my @aarray;
- my %hash;
- push(@{ $hash{"KEYNAME1"} }, "val11");
- push(@{ $hash{"KEYNAME1"} }, "val12");
- push(@{ $hash{"KEYNAME1"} }, "val13");
- push(@{ $hash{"KEYNAME2"} }, "val21");
- push(@{ $hash{"KEYNAME2"} }, "val22");
- push(@{ $hash{"KEYNAME2"} }, "val23");
- print "hash:\n";
- dumpValue(\%hash); # { feld => [w1 w2], ... }
- foreach my $feld (keys %hash) { # [ { feld => [w1 w2] }, ... ]
- my @array;
- foreach my $wert (@ {$hash{$feld}}) {
- print "wert $wert";
- push @array, $wert;
- }
- my %h;
- %h = ( $feld => [ @array ] );
- push @aarray, { %h };
- }
- #print "array:\n";
- #dumpValue(\@array);
- print "aarray:\n";
- dumpValue(\@aarray);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement