in reply to sockets and such in Perl
The nice thing about this algorithm is that it doesn't matter if you use files, pipes or sockets.read the first names from each file in name1, name2 and name3 while not (name1==name2 and name2==name3) { determine from which file came the name with the lowest alphabetica +l value read the next name from that file in the corresponding name1, name2 +, name3 variable } print name1, name2, name3
For the socket solution you would create three server processes and one client process. The client opens a socket to each of the servers. Each server process reads one of the files and writes the names one by one to the socket.
The perlipc man page shows several examples of clients and a server using IO::Socket. For the client you should not have to do anything more complex than the Simple client. The server can be simpler than the example shown; just remove all the prompts and command interpretation, and open the file and write the names to the client.
HTH
|
|---|