in reply to searching through hash values
> perl -MData::Dumper -e ' @arg{key} = (1 .. 6); print Dumper(\%arg);' $VAR1 = { 'key' => 1 };
Doesn't look quite right. An array (and you want an array, not a hash) with the elements 1..6 would be created with
Also you should check whether an element exists in a hash before you try to access it, if you don't want to create it through Autovivicationmy @arg= 1..6;
if (exists $hash{$_}) { foreach my $physh (sort keys %{$hash{$_}[2]}){ next if (!$hash{$_}[2]{$physh}[9]); ... }
Note that I just loop through all keys of the subhash and therefore don't need the array with numbers 1..6. That doesn't work if there are other keys in that subhash you don't want to test. In that case just use 1..6 instead of sort keys %{$hash{$_}[2]}
If you don't mind the sequence in which the hash elements are checked you can drop the sort.
|
|---|