bfish has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks!
I am trying to pass a two-dimensional array through a Win32::Pipe. This basically means that I need to convert the array to a string to "write" and then unconvert it to "read". To cut down on I/O through the pipe, I'd like to do this without having to use a "for" loop on either end.
A one dimensional array is encoded like this:
$Pipe->Write( join( "\0", @Array) );
And decoded like this:
@Array = split( "\0", $Pipe->Read() );
I've tried lots of different ways to encode/decode a two-dimensional array with no success. These have included:
1) Using multiple joins and splits (I end up passing a string like "ARRAY(0x20e301c)"
2) Using a number of variations on map (including one that used pack/unpack) and either got the string in (1) or nothing.
Please help!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Joining and splitting two dimensional arrays
by chromatic (Archbishop) on Aug 06, 2003 at 18:13 UTC | |
by bfish (Novice) on Aug 06, 2003 at 18:23 UTC | |
by antirice (Priest) on Aug 06, 2003 at 18:33 UTC | |
by bfish (Novice) on Aug 06, 2003 at 19:30 UTC | |
by bfish (Novice) on Aug 06, 2003 at 18:50 UTC | |
by antirice (Priest) on Aug 06, 2003 at 19:08 UTC | |
|
Re: Joining and splitting two dimensional arrays
by CombatSquirrel (Hermit) on Aug 06, 2003 at 19:57 UTC | |
by bfish (Novice) on Aug 07, 2003 at 18:42 UTC | |
|
Re: Joining and splitting two dimensional arrays
by Not_a_Number (Prior) on Aug 06, 2003 at 20:12 UTC |