06-20-2014 02:22 PM
06-23-2014 01:37 AM
Have you tried to see what output you get by doing a print dumper($hostname)?
Do mind that the Infoblox:NS::Host doesn't have a method called ipv4addr() but a method called ipv4addrs() which is an array of IP values and/or fixed address objects.
I once created a script to find all printers that were defined in Infoblox. As some printers have static IPs and some have a fixed DHCP address I needed to make sure in my script that the right value was retrieved. As I know that the printers only have 1 IP I also only took the first object/value in the area.
Here's my code snippet :
$ipaddr = $_->ipv4addrs-> if(!ref($_->ipv4addrs()->)); #contains value and not a reference
$ipaddr = $_->ipv4addrs->->ipv4addr() if(ref($_->ipv4addrs()->)); #contains reference to fixedaddress
print $_->name() & "\t" & $ipaddr & "\n";
I hope this can help.