Hi,<br> I've just started trying to use hashes. Basically I want to use a modules package name as the index to the hash so that when a trace function is called it checks to ensure that tracing has been turned ON in that package. <br><br> So I have an initialisation function whereby I read a text file of the form:<br><br>package1=ON<br>package2=ON<br>package3=OFF<br>...etc<br><br> And then these are split on the = and the hash set up:<br><br>e.g.<br><FONT FACE=monospace>%myhash = ();<br>while(<TRACECONFIGFILE>
<br>{<br> ($package_name, $trace_value) = split(/=/,$_);<br> $myhash{'$package_name', $trace_value);<br>}</font><br><br> So when the trace call is made, inside the trace function I want to do something like:<br><br><FONT FACE=monospace>if ($myhash{$package_name} eq "ON"
<br>{<br> trace a message to a file<br>}<br>else<br>{<br> don't do anything<br>}</font><br><br> Is doesn't work at the moment as in the <i>if</i> isn't returning true, even when the text file sets that hash to "ON"...<br><br> Hopefully that made sense! Really I just need to know how to use a scalar as the name of a hash key.. is this even possible?<br><br>Thanks for staying with me!<br>Loon