Correct me if I'm wrong here, but I think what David wanted was an easy way
to reference other keys of an hash while creating one, ie:

How to do this, in a line:

        %h = (  first => 10 );
        $h{second} = $h{first} * 2;

Because, as I'm sure you know, this code (when run w/out strict):

        my %h = (
                 first => 10,
                 second => $h{first} - 5
                 );
        print map { qq[$_ => $h{$_}\n] } keys %h;

Gives us this output:

        first => 10
        second => -5

<snip>
-----Original Message-----
From: Nathan Torkington [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 22, 2000 8:50 PM
[...]
So in my opinion, you haven't really come up with a strong argument
against:
</snip>

Perhaps \-> or \> might work:

        %h = (
                first          # a normal key
                        => 10    # with a vililla value

                second         # another key
                        \>first  # value references the value of 
                                 # the 'first' key of this hash
                );

I realy don't have any ideas of what a workable syntax would be but I do
think that being able to access already defined keys within the current hash
defination would be useful.

-Corwin

Reply via email to