LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Perl Script include (https://www.linuxquestions.org/questions/programming-9/perl-script-include-27578/)

mikeshn 08-09-2002 01:45 PM

Perl Script include
 
Hello

I have the code below that repeats in every Perl script(totally 22 script). I know that in C/C++ I can include the file. How can I do that in Perl? In other words, I want to make
function or include file and than call in each scipt

# 2 Send it to the socket

use IO::Socket;
$sock = IO::Socket::INET->new( PeerAddr => 'localhost',
PeerPort => '9399',
Proto => 'tcp'
);
die "Could not create socket: $! \n" unless $sock;
$sock->send($request);

# 3. Get feedback from socket and assign it to $feedback

$sock->recv($feedback,5000);
close ($sock);

# 4. Parse XML information

use XML::Simple;
my $xs1 = XML::Simple->new();
my $info = $xs1->XMLin($feedback);

Thanks

fork 08-20-2002 10:55 AM

require "mylib.pl";


All times are GMT -5. The time now is 06:45 AM.