Hello,
I've translated the following PHP snippet:
$data = array();
$num = 0;
$data[$num]['title'] = 'Name';
$data[$num]['data'] = 'Randall';
$num++;
$data[$num]['title'] = 'Email';
$data[$num]['data'] = '[EMAIL PROTECTED]';
$num++;
As this Perl:
my @data;
my $num = 0;
$data[$num]['title'] = 'Name';
$data[$num]['data'] = 'Randall';
$num++;
$data[$num]['title'] = 'Email';
$data[$num]['data'] = '[EMAIL PROTECTED]';
$num++;
Apparently it works, as I can access elements of both structures in
pretty much the same way in both languages. However, when I use the
PHP::Serialization module from CPAN to serialize the data in the Perl
version, using something like this:
serialize(@data);
Only a tiny part of @data can be read back in PHP. It seems the two
structures aren't equal after all.
I've tried also something along these lines:
my %h = ( title => '', data => '');
my @data = ( \%h );
my $num = 0;
$data[$num]{'title'} = 'Name';
$data[$num]{'data'} = 'Randall';
$num++;
This goes a bit further (slightly more data is available for
deserialization) but it doesn't work either.
What am I doing wrong?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/