in reply to Array/Hash?? Help Needed

It seems to me that you are looking for HoH (hash of hashes) or AoH (array of hashes); anyway, a two level data structure. On the first level, there's the id of this particular device, either the name or a numerical ID, as you hinted at. On the second level, there's a record, a hash, containing all the data for this particular device.

An introduction can be found in perlreftut, which is part of the standard documentation. The complete, authoritive reference is in perlref.

A bit more practical: I would think that there are mainly two ways to add this data to the data structure: either by field, or by record. I'll give an example of both.

my %data; # By record: $data{'Drive C'} = { 'Used Space OID' => '1.2.3.4.5.1', 'Size OID' => '1.2.3.4.6.1', 'Max Size' => 200000, 'Alocation Units' => 4096, }; # By field $data{'Drive C'}{'Used Space OID'} = '1.2.3.4.5.1'; $data{'Drive C'}{'Size OID'} = '1.2.3.4.6.1'; $data{'Drive C'}{'Max Size'} = 200000; $data{'Drive C'}{'Alocation Units'} = 4096;
Now the data structure these produce are identical — provided the hash entry didn't exist yet: $data{'Drive C'} now contains a reference to a hash, which in turn contains all the data for this particular drive. Autovivification will make this secondary hash spring to life in the latter case; for the former, the new anonymous hash replaces whatever was there before.

With sufficient caution, you can use any hash related function on it, for example keys():

foreach(sort keys %{$data{'Drive C'}}) { print "$_ = '$data{'Drive C'}{$_}'\n"; }

Since the value for $data{'Drive C'} is a hash reference, you can copy that value into a scalar — the copy still references to the same hash, you can even modify the original data through it — and access all the data for 'Drive C' in a simpler, possibly even somewhat faster, manner:

my $h = $data{'Drive C'}; foreach(sort keys %$h) { print "$_ = '$h->{$_}'\n"; }

As you hinted towards unique numerical ID's, you might use an array instead, pretty much in the same way:

$data[1] = { 'Used Space OID' => '1.2.3.4.5.1', 'Size OID' => '1.2.3.4.6.1', ... } $data[1]{'Used Space OID'} = '1.2.3.4.5.1';
Well, HTH.