natxo has asked for the wisdom of the Perl Monks concerning the following question:
I need to get the 'identifierValue' => 'XXXXXX' with IdentifierType key 'ServiceTag'$VAR1 = [ bless( { 'identifierType' => bless( { 'summary' => 'Asset ta +g of the system', 'label' => 'Asset Tag' +, 'key' => 'AssetTag' }, 'ElementDescription' +), 'identifierValue' => ' unknown' }, 'HostSystemIdentificationInfo' ), bless( { 'identifierType' => bless( { 'summary' => 'OEM spec +ific string', 'label' => 'OEM specif +ic string', 'key' => 'OemSpecificS +tring' }, 'ElementDescription' +), 'identifierValue' => 'Dell System' }, 'HostSystemIdentificationInfo' ), bless( { 'identifierType' => bless( { 'summary' => 'OEM spec +ific string', 'label' => 'OEM specif +ic string', 'key' => 'OemSpecificS +tring' }, 'ElementDescription' +), 'identifierValue' => '5[0000]' }, 'HostSystemIdentificationInfo' ), bless( { 'identifierType' => bless( { 'summary' => 'Service +tag of the system', 'label' => 'Service ta +g', 'key' => 'ServiceTag' }, 'ElementDescription' +), 'identifierValue' => 'XXXXXXXX' }, 'HostSystemIdentificationInfo' ) ];
$VAR1 in Data::Dumper is an anonymous array
I tried this (among other stuff:my $add_info = $host_view->summary->hardware->otherIdentifyingInfo;
But I get "Undefined subroutine &HostSystemIdentificationInfo::_identifierValue called at script line 24" so I am failing miserably. Any help greatly appreciated.foreach (@$add_info) { if ( $_->identifierType->key eq "ServiceTag" ) { print $_->_identifierValue , "\n" ; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: dereferencing ... again
by davido (Cardinal) on Nov 01, 2013 at 20:32 UTC | |
by natxo (Scribe) on Nov 01, 2013 at 20:49 UTC | |
by davido (Cardinal) on Nov 01, 2013 at 22:33 UTC | |
|
Re: dereferencing ... again
by AnomalousMonk (Archbishop) on Nov 02, 2013 at 12:01 UTC |