hash of hashes

J

John

Hi

Cannot work this one out.

The following works OK:

my $test1=$der->encode({type => 'sequence',
value => [{type => 'integer', value => 55},{type => 'string', value =>
'HALLO'}]
});

Rather than placing the hash in the routine call I want to place it outside
and call it $der->encode(%hash);

my %hash;
$hash{type}='sequence';
$hash{value}{type}='integer';
$hash{value}{value}='55';
if I now say
$hash{value}{type}='string';
$hash{value}{value}='hallo';
it will overwite 'integer' and '55'

How do I get around that?

Regards
John
 
J

J. Gleixner

John said:
Hi

Cannot work this one out.

The following works OK:

my $test1=$der->encode({type => 'sequence',
value => [{type => 'integer', value => 55},{type => 'string', value =>
'HALLO'}]
});

Rather than placing the hash in the routine call I want to place it outside
and call it $der->encode(%hash);

my %hash;
$hash{type}='sequence';
$hash{value}{type}='integer';
$hash{value}{value}='55';
if I now say
$hash{value}{type}='string';
$hash{value}{value}='hallo';
it will overwite 'integer' and '55'

How do I get around that?

Regards
John

perldoc perldsc

push( @{ $hash{ 'value' } },
{ type=> 'integer', value => '55' },
{ type=> 'string', value => 'hallo' } );
 
J

John

J. Gleixner said:
John said:
Hi

Cannot work this one out.

The following works OK:

my $test1=$der->encode({type => 'sequence',
value => [{type => 'integer', value => 55},{type => 'string', value =>
'HALLO'}]
});

Rather than placing the hash in the routine call I want to place it
outside and call it $der->encode(%hash);

my %hash;
$hash{type}='sequence';
$hash{value}{type}='integer';
$hash{value}{value}='55';
if I now say
$hash{value}{type}='string';
$hash{value}{value}='hallo';
it will overwite 'integer' and '55'

How do I get around that?

Regards
John

perldoc perldsc

push( @{ $hash{ 'value' } },
{ type=> 'integer', value => '55' },


Many thanks.
Regards
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top