<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Apr 13, 2013 at 1:29 AM, Digimer <span dir="ltr"><<a href="mailto:lists@alteeve.ca" target="_blank">lists@alteeve.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi all,<br>
<br>
  I've got a rather large, random-depth hash. ie:<br>
<br>
$conf->{foo}{bar} = "a";<br>
$conf->{baz} = "1";<br>
$conf->{this}{and}{the}{other}<u></u>{thing} = "what?";<br>
<br>
  And so on. The number of hash keys can be quite varied, depending on the use.<br>
<br>
  So now I want to be able to take a string that is in the format:<br>
<br>
foo::bar<br>
baz<br>
this::and::the::other::thing<br>
<br>
  Split on the :: and use that to pull the value out of the hash.<span class=""><font color="#888888"><br></font></span></blockquote><div><br></div><div></div></div><br></div><div class="gmail_extra" style>Use eval. </div>
<div class="gmail_extra" style><br></div><div class="gmail_extra" style>It's pretty simple to transform "this::and::the::other::thing" into {this}{and}{the}{other}{thing}, and the next thing is to pull the value out of the hash:</div>
<div class="gmail_extra" style><br></div><div class="gmail_extra" style><br></div><div class="gmail_extra"><div class="gmail_extra">$ perl -d -e 0</div><div><div><br></div><div>DB<5> eval '$conf->{foo}{bar} = "a";'</div>
</div><div><br></div><div><div>  DB<6> p $conf->{foo}{bar}</div><div>a</div></div><div><br></div><div style>HTH</div><div style><br></div><div style>Antonio</div><div style><br></div><div style><br></div></div></div>