in reply to resolving variable names within variable names.

We discussed this problem recently at Parse C-like define statements. Using a variation on the solution presented by danger and sfink:
# after your first foreach loop foreach my $key (keys %var) { 1 while $var{$key} =~ s/([a-z_]+)/$var{$1}/; $var{$key} = eval "$var{$key}"; }
should do the trick.

On another note - i would remove the first line in your first foreach loop (the one with the tr) and change the last line of that loop to:

$var{$key} = "\L$value\E";
UPDATE - or maybe not :) - i overlooked the fact that the first few lines of the output have uppercase keys - my mistake.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re: (jeffa) Re: resolving variable names within variable names.
by Octavian (Monk) on Jun 04, 2002 at 16:29 UTC
    you da man...that worked great....I thank you for that...I get in that deep and my brain starts to hurt....course now looking at the logic of it it seems easy :P