Greetings,
Am using perl to dynamically write some JavaScript code
that creates cool drop down button menus by Ger Versluis found
on http://www.dynamicdrive.com ( for those who want to
know why).
Have a directory structure in which the target files are located
at various levels of sub-directories.
Trying to create a dynamically sized hash of unknown dimensions
where each sub directory name is a dimension of the hash and it
gets assigned the file.
For example
my(%HASH);
$HASH{$sub1}{$sub2}{$sub3} = $file1;
$HASH{$sub1}{$sub2}{$sub3}{$sub4}{$sub5} = $file2;
Here is what I tried, unsuccessfully
no strict 'refs'
# @TERMS is an array of each sub-directory name up to the one containing the target
file
my(%NAV_HASH);
# Build the multi-dimensional hash
my($hash_string) = "NAV_HASH";
foreach my $sub_dir (@TERMS){
$hash_string .= "{\"$sub_dir\"}";
}
print "hash_string = $hash_string\n" if ($DEBUG == 1); # <- This looks
good
# Producing a hash_string =
NAV_HASH{"Africa"}{"focus_regions"}{"OEF_Somalia"}{"Overview"}{"high_low_cloud"}
# Now turn this string into a real hash and
# assign it a value
$$hash_string = "$last,";
Afterwards running this shows I've accomplished nothing
if ($DEBUG == 1){
print "<p>Here is the NAV_HASH:\n";
foreach (keys(%{$$hash_string})){
print "<br>$_ => $$hash_string{$_}}\n";
}
}
$$hash_string is NOT a hash. <-- Herein lies the problem as Billy Zardell would say
Thank you for any assistance,
John Kent
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]