in reply to If hash not defined help
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"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: If hash not defined help
by AnomalousMonk (Archbishop) on Jul 07, 2017 at 02:57 UTC | |
|
Re^2: If hash not defined help
by johnfl68 (Scribe) on Jul 07, 2017 at 04:50 UTC | |
by AnomalousMonk (Archbishop) on Jul 07, 2017 at 05:39 UTC |