1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#!/usr/bin/perl -w foreach $key (keys %value_xml){ if($key eq "IAFIM"){ foreach $dis (sort keys %{$value_xml{$key}}){ print "\n4: $key - $dis"; } } } if (defined $value_xml{"IAFIM"}{"PLMN-PLMN/MRBTS-999977/LNBTS-999977/LNCEL-1"}{"ocAcBarAC"}) { print "yes"; }else{ print "no";} foreach $key (keys %value_xml){ if($key eq "IAFIM"){ foreach $dis (sort keys %{$value_xml{$key}}){ print "\n4: $key - $dis"; } } }
if(defined $hash{ $key })
my $foo = $hash{$key}; if(defined $foo)
1
2
3
4
5
6
$ perl -wE'
my %hash = ( a => 1 );
my $foo = $hash{foo};
if(defined $foo) { 1 }
say keys %hash;'
a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ perl -wE'
my %hash = ( a => 1 );
if (defined $hash{b}) { 1 }
say "defined b: ",keys %hash;
if (exists $hash{c}) { 1 }
say "exists c: ", keys %hash;
if (defined $hash{B}->{foo}) { 1 }
say "defined deref B: ", keys %hash;
if (exists $hash{C}->{foo}) { 1 }
say "exists deref C: ", keys %hash;
'
defined b: a
exists c: a
defined deref B: aB
exists deref C: aCB