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