in reply to LWP vs CGI

Did you read their manuals? There are tons of examples of each.

Nutshell: Use LWP to write clients and CGI to write servers.