foreach my $device (@{$vm->{config}->{hardware}->{device}}){ if($device){ print ref( $device ),"\n" } }