yitzle wrote: > On Mon, Aug 11, 2008 at 9:52 AM, Dermot <[EMAIL PROTECTED]> wrote: >> >> I am trying to make hash that refers to itself like this >> >> my %_HASH; >> %_HASH = ( >> typeOne => { >> root => '/path/to/typeOne', >> logfile => $_HASH{typeOne}->{root}.'/logone.log'; >> }, >> typeTwo => { >> root => '/path/to/typeTwo', >> logfile => $_HASH{typeTwo}->{root}.'/logtwo.log'; >> } >> ); >> >> >> But nothing is initialised at this point so $_HASH{typeOne}->{root} is >> an uninitialized value when creating and logfile key. >> >> Is there a way around this? > > Not the way you are doing it. This would work, though: > > my %_HASH; > %_HASH = ( > typeOne => { > root => '/path/to/typeOne', > logfile => $_HASH{typeOne}->{root}.'/logone.log'; > }, > typeTwo => { > root => '/path/to/typeTwo', > logfile => $_HASH{typeTwo}->{root}.'/logtwo.log'; > } > );
- You are a frequent enough poster to know that bottom-posting is the preferred style on this group - What you have posted is identical to the code that the OP said didn't work - Your code won't even compile as it has semicolons where there should be commas, so you cannot possibly have tested it Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/