Hello.
I am learning vSphere perl SDK and trying to udnerdstand how to use various furcntion before I start writting real-life scripts.
I want to print the MAC address of all the VMs that are running in my vCetner.
Here is the code snippet that I have written:
my $vm_views = Vim::find_entity_views ( view_type => "VirtualMachine");
foreach my $vm (@$vm_views)
{
print "The MAC of " .$vm->name . " is " . $vm->guest->net->macAddress . "\n";
}
And here is hte error i get whne I run above script:
Can't call method "macAddress" on unblessed reference at test.pl line 31
Could someone tell me where I am going wrong. i know this has something to do wit hte belssed reference but not able to figure that out.
This should be an easy one for anyone who has used perl SDK in past.
Thanks.