in reply to Hash of Hash

I'm not sure, but you can use a reference for this purpose:
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $string = q(one tow three four five six); my @words = split(/ /, $string); my %hash1; my %hash2; $hash2{$words[1]} = join(" ", @words[2..5]); $hash1{$words[0]} = \%hash2; print Dumper(%hash1);
best regards neniro

Replies are listed 'Best First'.
Re: Re: Hash of Hash
by Skeeve (Parson) on Feb 29, 2004 at 09:49 UTC
    Just a hint. Instead of
    my $string = q(one tow three four five six); my @words = split(/ /, $string);
    You might want to use
    my @words= qw(one tow three four five six);
    As you no longer use $strings, there is no need for you to split on that.

    And as you don't really have a need for $hash2, this might help by using an anonymous hash:
    $hash1{$words[0]}= { $words[1] => join(' ', @word[2..$#words]) };