FWIW, I tried your 3 methods, and all 3 give me the same result on the 172.16.1.2 ip: "does not ping".
Other observation:
$p->close(); is never executed because you always return from the sub before you reach that line. From the Net::Ping docs, you don't even need to close when your code is inside a sub.