Hey List,

I am working on a problem where I have a hash of a hash that need
updating and to be writen back into a text file.  At the moment the hash
looks like this...

%hash = (
             'Crud1' => {
                          'test1' => 'crud10',
                          'test2' => 'crud11'
                        },
             'Crud2' => {
                           'test1' => 'crud10',
                           'test2' => 'crud11'

                         },
             'Crud3' => {
                            'test1' => 'crud10',
                            'test2' => 'crud11'
                          }
           );

Is it possible to change all the values of crud10 to crud9.  At the
moment my code looks like this...

read_config(); #create hash like above. At the moment it works fine
#change variable of crud10 to crud 9...
$hash{$hashname}{'test1'}= "crud9";
write_config($tunnelfile, %tunnels);
#Write config looks like this...

sub write_config {
    open FILE, ">$tunnelfile" or die "cannot open $tunnelfile: $!\n";
    for $t (keys %hash) {
        print $t, "\t\n\n";;
        print FILE "[$t]\n";
        print FILE "$_=$hash{$t}{$_}\n" for keys %{$tunnels{$t}};
    }
    close(FILE)               or die "Closing: $!";
}

But for some reason write_config will only change %Crud3 ( 'test1' =>
'crud9'); ...

and nothing else.  Am I missing something major here?

Kind regards,

Dan
 
==============================
VINTEK CONSULTING PTY LTD
(ACN 088 825 209)
Email:  [EMAIL PROTECTED]
WWW:    http://www.vintek.net
Tel:    (08) 8523 5035
Fax:    (08) 8523 2104
Snail:  P.O. Box 312
        Gawler   SA   5118
==============================


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to