in reply to Re: selecting from a number of different input sources.
in thread selecting from a number of different input sources.

This is how I am opening up the file to read, not sure what do I need to do to read the text files as a socket instead, and how that would help.

my $io = new IO::Handle; open (my $fh, '<', $FILE) or die $!; if ($io->fdopen(fileno($fh), "r")) { ...

Replies are listed 'Best First'.
Re^3: selecting from a number of different input sources.
by almut (Canon) on Jul 21, 2010 at 17:40 UTC

    It's not immediately clear from the docs, but just saying use IO::Handle entitles you to call IO::Handle methods on normal file handles like your already opened $fh.  In other words, your snippet could be simplified as follows:

    use IO::Handle; open (my $fh, '<', $FILE) or die $!; # then simply call method from IO::Handle $fh->getline();

    This doesn't answer the question how to make a socket out of a regular file, but I thought it's worth mentioning nevertheless...