in reply to using hash key as hash value ...

At the time you access the value $media{bond}, it does not yet exist. To get around this, you can do something like:
$_ = "a:default:value" for @hash{'key1', 'key2', 'key3'}; # or $hash{$_} = "a:default:value" for 'key1', 'key2', 'key3'; # or @hash{'key1', 'key2', 'key3'} = ("a:default:value") x 3;
If you actually want one key of a hash to be an alias to another key, you'll have to do some tie() magic.

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Replies are listed 'Best First'.
Re: Re: using hash key as hash value ...
by blueflashlight (Pilgrim) on Oct 02, 2001 at 07:10 UTC
    yow. that's more involved then I wanted to get into. (Actually, the reason I'm trying to do what I'm trying to do is to make my code "easy" to read for other people at my org. who may need to modify it.)

    Tie::AliasHash looks cool, though ... perhaps I'll try it out sometime.

    thanks! --sandy