in reply to Re^2: loading a hash of hashes from UNIX command output
in thread loading a hash of hashes from UNIX command output

Sounds like you want to lookup the volume for a given slot address and that you want to do that for multiple volumes during the run of the program.

If you have the inventory in a variable:

my %slot_lkup = reverse map /^Slot address (\d+).*\n +Volume Tag[ .]+([^\n]+)/s, split /(?<=\n)(?! )/, $inventory; ... $slot_lkup{$vol} ...

If you have the inventory in a file handle:

my %slot_lkup; { my $slot; while (<$fh>) { if (/^Slot address (\d+)/) { $slot = $1; } elsif (/^ *Volume Tag[ .]+([^\n]+)/) { $slot_lkup{$1} = $slot; } } } ... $slot_lkup{$vol} ...