in reply to User-Agent

Just remove one blank, your code now works. In between 'HTTP' and '/1.0', there should be no space, i.e. it should be 'HTTP/1.0'.

use IO::Socket; $sock = new IO::Socket::INET ( PeerAddr => 'www.yahoo.com', PeerPort => 80, Proto => 'tcp', Timeout => 10, ); die "Socket could not be created $!\n" unless $sock; print $sock "GET /page?pg=somewhere.html HTTP/1.0\nUser-Agent: Mozill +a/4.0 (compatible; MSIE 5.01; Windows 98; ocnie5-1)\nContent-Type: te +xt/html; charset=EUC-JP\n\n"; while($line = <$sock>) { print "$line\n"; } exit 0;
Now yahoo no longer complains about received a bad request.

Of course, because the page you requested does not exist on yahoo, yahoo would reply and say that the page you requested didn't exist, but your request is now well formated.