in reply to using hash key as hash value ...
You can do what you're after, but you need to do it in two steps. The first step is to create your hash with the bond key in it, and the second step is to fill in the other values. For example:
This does what you're after. Putting %media as the first entry when re-assigning the hash makes sure that the old values are put back in.my %media = (bond => "USLetter:Plain:white:75"); %media = (%media, letter => $media{bond}, plain => $media{bond});
Of course, TMTOWTDI. The following is probably faster (as we're not copying the hash back into itself), and more compact, but more difficult to understand.
Cheers,my %media = (bond => "USLetter:Plain:white:75"); @media{qw/letter plain/} = @media{qw/bond bond/};
|
|---|