# establish connection my $socket = IO::Socket::UNIX->new( Peer => '/path/to/socket.file.sock', ) # issue command and read answer print $socket "$some_command\n"; $html = "". sockread($socket) ""; sub sockread { my $socket = shift; my $content; while (my $line=<$socket>){ $content .= $line; last if $line =~ /\[ End of /i; # vlc's rc is a bit inconsistent, some end like this last if $line =~ / returned 0 /i; # others like this } return $content; }