in reply to Problem with example UDP script from Perl Little Black Book
You probably want to include a
use strict; use warnings;
at the top.
I would guess the problem is that localhost should be enclosed in quotes like "localhost".
Update: Added working code.
Below is code that works for me.
#!/usr/bin/perl.exe use IO::Socket; use strict; use warnings; my $socket; $socket = IO::Socket::INET->new(Proto => 'udp', PeerPort => 80, PeerAddr => "localhost") or die "opening port, $! "; $socket->send("Hello");
|
|---|