1 2 3 4 5 6 7 8 9 10 11 12
my @Logwerte = ( { Name => "Name1", GAs => ({GA => "GA1", columnName => "A"})}, { Name => "Name2", GAs => ({GA => "GA2", columnName => "A"}, {GA => "GA3", columnName => "B"})}, ); # log each group address foreach my $element (@Logwerte) { foreach my $GAelement ($element->{GAs}) { plugin_log($plugname, "subscribe for GA [$GAelement->{GA}] and columnName [$GAelement->{columnName}]"); } }
1
2
3
2011-12-15 23:13:02.211,TestPlugin,subscribe for GA [GA1] and columnName [A]
2011-12-15 23:13:02.212,TestPlugin,subscribe for GA [GA2] and columnName [A]
2011-12-15 23:13:02.213,TestPlugin,subscribe for GA [GA3] and columnName [B]
1
2
2011-12-15 23:13:02.211,TestPlugin,subscribe for GA [GA1] and columnName [A]
2011-12-15 23:13:02.212,TestPlugin,subscribe for GA [GA2] and columnName [A]
foreach my $GAelement (@($element->{GAs}))
for my GA ( @{ $element->{GAs} } ) { ...
$Logwerte[1]{'GAs'}
1 2 3 4 5 6 7 8 9 10 11 12 13 14
my @Logwerte = ( { Name => "Name1", GAs => [{GA => "GA1", columnName => "A"}]}, { Name => "Name2", GAs => [{GA => "GA2", columnName => "A"}, {GA => "GA3", columnName => "B"}]}, ); # log each group address for my $element (@Logwerte) { for my $GAelement (@{$element->{GAs}}) { print "subscribe for GA [$GAelement->{GA}] and columnName [$GAelement->{columnName}]") } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
my @Logwerte = ( { Name => "Name1", GAs => { GA => "GA1", columnName => "A" } }, { Name => "Name2", GAs => { GA => "GA2", columnName => "A" }, 'HASH(0815)' => undef }, );
Quoteich beschäftige mich neu mit Perl, da ich eine kleine Linux-Box erstanden habe
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/usr/bin/python # coding: iso-8859-1 Logwerte = [{ "name" : "Name1", "GAs" : [{ "GA" : "GA1", "columnName" : "A"}]}, { "name" : "Name2", "GAs" : [{ "GA" : "GA2", "columnName" : "A"}, { "GA" : "GA3", "columnName" : "B"}]}] for element in Logwerte: for GAelement in element["GAs"]: print "subscribe for GA " + GAelement["GA"] + " and columnName " + GAelement["columnName"]
2011-12-15T23:42:11 hlubenowUnd da mußt Du gleich so komplexe Strukturen benutzen?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#!/usr/bin/perl use warnings; use strict; my @Logwerte = ({ name => "Name1", GAs => [{ GA => "GA1", columnName => "A"}]}, { name => "Name2", GAs => [{ GA => "GA2", columnName => "A"}, { GA => "GA3", columnName => "B"}]}); for my $element (@Logwerte) { for my $GAelement (@{$element->{GAs}}) { print "subscribe for GA [$GAelement->{GA}] and columnName [$GAelement->{columnName}]\n"; } }
2012-02-25T17:33:49 pqich hatte es ja schonmal erwähnt: bitte mach deine edits kenntlich, es gibt dafür auch ein extra kommentarfeld.
du änderst teilweise deine artikel komplett und dann machen antworten darauf gar keinen sinn mehr.
dafür ist die edit-funktion nicht gedacht. häng den neuen inhalt im zweifel unten dran oder schreib einen neuen artikel.