1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl
use strict;
use warnings;
use JSON;
use Data::Dumper;
my $json = '{...} | {"Contacts": {"SubscribedFolders": ["wert1", "wert2", "wert3"]}}';
my $text = decode_json((split / ?\| ?/, $json)[1]);
print Dumper($text);
my @var1 = ($text->{'Contacts'}->{'SubscribedFolders'});
my $var2 = @var1;
print Dumper(@var1, $var2);
2016-12-04T20:05:56 Traceman
Warum steht in $var2 nicht 3?
my $laenge = @{$text->{'Contacts'}->{'SubscribedFolders'}};
1 2 3 4 5 6 7
# hier knallt es my $text = decode_json((split / ?\| ?/, $json)[1]); # weil $json[1] nämlich gar nicht definiert ist.
print Dumper [split / ?\| ?/, $json];