"I didn't even try running it because it has the bareword of udp there which I'm pretty sure is illegal?"
So you found two documentation "typos". One was a reading comprehension and instruction following issue on your part, the other was a lack of testing or investigation.
The examples in the IO::Socket::INET documentation are not run under strict, so a bareword is completely legal and legitimate. Not only that, it appears as though you changed the excerpt, so it's not even an authentic example from their documentation.
blah(bareword);
sub blah {
my $word = shift;
print "$word\n";
}
Output:
bareword