* Saurabh Singhvi ([EMAIL PROTECTED]) wrote: > HI > > i was looking to make a hash inside hash. Something like > > %hash = { "key" => {"key1" => value} }; > > is this the correct way to define it??? Also, > is > $hash{key->key1} > > this the way to call it ?? if not kindly tell me. > > thanks > Saurabh
Hello, You were close. %hash = ( "key" => {"key1" => value} ); To define a hash use () brackets the second hash is inserting not a hash but a reference to a hash so you use {} brackets. You refer to 'value' it as $hash{key}->{key1}. $hash{key} is a scalar contains a reference pointing to a hash (so $hash{key}->{ }) and the key is key1 (so $hash{key}->{key1}). Regards, Ben Marsh -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>