in reply to Re^4: Can a socket listen for multiple hosts?
in thread Can a socket listen for multiple hosts?

Adjust
$buf =~ s/\G(.*\n)//g
to match your definition of record. If your record terminator is "***", you can use
$buf =~ s/\G(.*?\*\*\*)//sg

If your records are double quoted strings, you can use

$buf =~ s/\G("(?:[^"\\]|\\.)*")//sg

If you're using fixed-length records, you can use

$buf =~ s/\G(.{128})//sg
etc.

Replies are listed 'Best First'.
Re^6: Can a socket listen for multiple hosts?
by sierpinski (Chaplain) on Aug 16, 2010 at 15:16 UTC
    I found this thread while super-searching on another Socket question I had, and realized I never updated it with how I ended up achieving this. I user Data::Dumper to flatten the hash into a scalar, sent that to the server, then used eval to turn it back into a hash, and it worked flawlessly.

    Of course now I'm trying the educational task of creating a two-way client-server app using IO::Socket without going back and copy/pasting a bunch of code. I'm learning much more this way, but it's taking me a bit longer to get it working. Thanks again for the responses ikegami!