in reply to socket programming error while using it in modular way

Just so any beginners that are reading this thread don't get the wrong idea: There are easier ways to surf the Internet using Perl. One does not have to immerse themselves in this level of detail.

For example, WWW::Mechanize from CPAN.

One can drive a Formula 1 race car to work. It gives one total control. It also requires specialized training. 99.99% of the population doesn't need that level of control.