OK first I like your method better for selecting the IP's it's much cleaner (my way is what happens when people with Arts degrees try to write code). And I didn't see the dependencies so those are now in.

So now we have what I think might be our last error:

Script Error: array reference out of bounds!
$iparray[1]='192.168.3.0/24'