while (my ($name, $hash) = each %nfs) { for my $devloc (ref $hash->{'%filer_device'} ? keys %{$hash->{'%filer_device'}} : '%filer_device') { # hack here my $device = (ref $hash->{'%filer_device'} ? $hash->{'%filer_device'} : $hash)->{$devloc}; # and here my $volume = ref $hash->{'%filer_volume'} ? $hash->{'%filer_volume'}{$devloc} : $hash->{'%filer_volume'}; print "\@dev $name $device $volume $hash->{'%export_name'}\n"; } }