Sometimes "too much is as bad as too little" applies to information as well as other things. In this case, the info supplied by Data::Dumper::Dumper (or whomever you're using to dump your structure) may be confusing: all those bless({ ... }, 'SomeThing') thingamabobs, what's that about? That's just the way your dumper utility represents a bless-ed reference; in fact, an object reference in this case.
A Perl object is simply a reference blessed into a package/class (see perlobj, perltoot, among others.). The reference is usually to a hash, but can be any kind of reference.
Shorn of its blessedness, the dumped data structure can be viewed as an array of anonymous hashes, with each hash harboring an anonymous sub-hash:
In fact, it's an array of objects, as shown by the bless({ ... }, 'PackageName') wrapper of each anonymous hash, with each object containing, along with whatever else, a sub-object.$VAR1 = [ { 'identifierType' => { 'summary' => 'Asset tag of the system', 'label' => 'Asset Tag', 'key' => 'AssetTag', }, 'identifierValue' => 'unknown', }, { 'identifierType' => { 'summary' => 'OEM specific string', 'label' => 'OEM specific string', 'key' => 'OemSpecificString', }, 'identifierValue' => 'Dell System', }, { 'identifierType' => { ..., 'key' => 'OemSpecificString', }, 'identifierValue' => '5[0000]', }, { 'identifierType' => { ..., 'key' => 'ServiceTag', }, 'identifierValue' => 'XXXXXXXX', }, ];
As has been pointed out, the blessedness of a reference does not prevent it from being accessed as an ordinary reference using the standard arrow operator:
$VAR->[1]{identifierType}{label} = 'whatever';
if ($VAR->[2]{identifierValue} eq ...) { ... }
However, Don't Do That! As davido has wisely advised, use the accessor/mutator (get/set) methods that are or should have been provided with the class. If such a method does not exist for the data you want to access, this may be telling you that you should not be accessing this data and should think again about what you want to do. (OTOH, lack of such a method may simply mean that the class is badly designed!)
In reply to Re: dereferencing ... again
by AnomalousMonk
in thread dereferencing ... again
by natxo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |