Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
In this way I can build the structure completely the second part of the structure is build dynamically by my input/gui thingy :-).<some make up code> while(($key, $value) = each(%hservers)) { $hserver{$keyX}->[0]->[1] ="some value"; $hserver{$keyX}->[1]->[0]->[0] ="1"; #secondpart $hserver{$keyX}->[1]->[0]->[1] =1; #secondpart $hserver{$keyX}->[1]->[0]->[2] ="parX"; #secondpart } </some make up code>
Any pointers where I went wrong ?while(($key, $value) = each(%$href)) { %$href{$key}->[1]->[0]->[0] = 1; #this gives a syntax error %{$href{$key}}->[1]->[0]->[0] = "blah" #gives error print "$key\n"; # but when i do this the code prints all the keys o +f the reference to the hash. so I assume the the hash was passed thr +ough correctly }
dump of the hash
$VAR1 = 'server1'; $VAR2 = [ [ '', '4', '0', '0', '-1', '0', '', '0' ], [ [ 1, 1, 'par 2' ], [ 2, 999, 'par 1' ] ] ]; $VAR3 = 'server2'; $VAR4 = [ [ '', '2', '0', '0', '-1', '0', '', '0' ], [ [ 1, 1, 'par 2' ], [ 2, 999, 'par 1' ] ] ]; $VAR5 = 'server3'; $VAR6 = [ [ '', '3', '0', '0', '-1', '0', '', '0' ], [ [ 1, 1, 'par 2' ], [ 2, 999, 'par 1' ] ] ];
CODE and READMORE tags added by Arunbear
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: references troubles
by philcrow (Priest) on Sep 22, 2005 at 18:56 UTC | |
|
Re: references troubles
by graff (Chancellor) on Sep 22, 2005 at 19:34 UTC | |
|
Re: references troubles
by ysth (Canon) on Sep 23, 2005 at 06:05 UTC |