Hello list,
To day I am trying to figure out the best way to send a hash to a socket and have the receiver be able to use it as a hash.
The best way I've done so far is to Data::Dumper the hash into a string and send the string, then parse the string back into a hash on the other end.
So client side is something like this: # where hashtostring() puts Data::Dumper's output into a string my $hash_in_string = hashtostring(\%hash); print $sock $hash_in_string; ...
and the server has something like this: # where stringtohash() take the string # (from hashtostring() above) and parses into a hash while ($new_sock = $sock->accept()) { while (defined($buf = <$new_sock>)) { foreach ($buf) { my %hash_from_client_string = stringtohash($_); ...
That works but I am wondering if there is a better way or an already existent way to do that. -IE hashtostring() and stringtohash()-
I can't use refs of course because the server will receive the text HASH.... from the client and that wouldn't be too useful in the server.
TIA
Lee.M - JupiterHost.Net
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>