#!/usr/bin/perl use warnings; use strict; use IO::Socket; our $iroam_req = 'FindMin TLK 91271558098436895219S 95TestRSU333333333 888888885555520070718103045'; our($sock); main_process(); sub main_process{ print "main process sub....\n"; open_socket(); print $sock $iroam_req; my $return; $sock->recv( $return, 1024 ); print "return-> $return\n"; <>; # hit a key to exit } sub open_socket{ $sock = new IO::Socket::INET ( PeerHost=> 'localhost', PeerPort => '18490', Proto => 'tcp', ); die "Could not create socket: $!\n" unless $sock; }