in reply to perl udp broadcast

Are you saying that you get your address and gateway from a DHCP server and that you would like to send a UDP packet to the broadcast address? If so, then sure, check out IO::Socket::INET.

If you want to do the above, but get the packet routed past the gateway, well, most routers won't pass a broadcast packet along so you're probably out of luck unless you can configure your gateway to pass it along, which is generally a bad idea.