[tpm] why aren't field counts being preserved?
Fulko Hew
fulko.hew at gmail.com
Wed Apr 28 09:44:04 PDT 2010
What am I doing wrong here???
I want to have an octet string that uses nulls to delimit fields,
and then the receiver should be able to 'split' on nulls to
restore the original array.
Empty strings in the middle of the array are preserved, but
empty strings at the end of the array are not.
I need them all to be preserved!
What am I missing?
TIA
Fulko
#!/usr/bin/perl
use Data::Dumper;
my @x = ( 'a', 'b', 'c', ' ', 'd', '', '' );
my $f = join ("\x00", @x);
print Dumper(@x);
print unpack ('H*', $f), "\n\n";
@r = split ("\x00", $f);
print Dumper(@r);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20100428/a6f500fb/attachment.html>
More information about the toronto-pm
mailing list