When trying to connect some network device using Perl you have a number of choices.

See the full stack of HTTP connections:

At the lowest level you can use the built in socket function.

Using the Socket library provides several extra functions
and constants that will make your code cleaner and more portable.

See also perlipc

plackup examples/server.psgi