use strict; use warnings; use Data::Dumper; { my $current= { 'version' => '2.0', 'xmlns:media' => 'http://search.yahoo.com/mrss/', 'fileSet' => { 'time' => '1499387013', 'fileName' => 'Atlanta_Regency.gif', 'emailAddress' => 'johndoe@gmail.com', 'requesterName' => 'John Doe', 'showAbbreviation' => {}, 'zoneColor' => '0' } }; if (exists($current->{'fileSet'}->{'showAbbreviation'}) && defined ($current->{'fileSet'}->{'showAbbreviation'}) && ( scalar(keys %{$current->{'fileSet'}->{'showAbbreviation'}}) > +0) ) { my $showAbbreviation = $current->{'fileSet'}->{'showAbbreviation +'}; print "Yes: showAbbreviation\n"; print Dumper($showAbbreviation)."\n"; } else { print "No: showAbbreviation\n"; } } { my $current= { 'version' => '2.0', 'xmlns:media' => 'http://search.yahoo.com/mrss/', 'fileSet' => { 'time' => '1499387013', 'fileName' => 'Atlanta_Regency.gif', 'emailAddress' => 'johndoe@gmail.com', 'requesterName' => 'John Doe', 'showAbbreviation' => {a=>1}, 'zoneColor' => '0' } }; if (exists($current->{'fileSet'}->{'showAbbreviation'}) && defined ($current->{'fileSet'}->{'showAbbreviation'}) && ( scalar(keys %{$current->{'fileSet'}->{'showAbbreviation'}}) > +0) ) { my $showAbbreviation = $current->{'fileSet'}->{'showAbbreviation +'}; print "Yes: showAbbreviation\n"; print Dumper($showAbbreviation)."\n"; } else { print "No: showAbbreviation\n"; } }
In reply to Re: If hash not defined help
by huck
in thread If hash not defined help
by johnfl68
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |