I have a multidimensional data structure for tracking different characteristics of files I am comparing and merging data for. The structure is set up as such:
$cumulative{$slice} = {
DATA => $data,
META => $got_meta,
RECOVER => $recover,
DISPO => $dispo,
DIR => $dir,
};
All of the keys, save DIR
(which is just a simple string), are references to hashes, or arrays. I would like to have a simple search for KEYS that match "BASE" for the value DIR
points to for each of the $slice
keys. My initial thought was to use grep, but I'm not sure how to do that. I thought something like this would be ok:
my (@base_slices) = grep { $cumulative{$_}->{DIR} eq "BASE" } @{$cumulative{$_}};
I was wrong. Is there a way to do this without a loop, or is that pretty much the only way to check those values? Thanks!
Edit: Thanks to Ikegami for answering succinctly, even without my fully representing the outcome of the search. I have changed the question a little bit to more clearly explain the issue I was having.