in reply to Re: Hash keys reference
in thread Hash keys reference

Well, actually, the reference makes it exist. It's the hash assignment that delinks it. Witness the result of:
%last_name = (); $x = \$last_name{fred}; # creates hash element, value is undef $last_name{fred} = "flintstone"; print $$x; # prints flintstone
So, your array-slice example would also work on a hash slice:
undef %last_name; @last_name{qw(fredref fred)} = (\$last_name{fred}, " +flintstone");

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: •Re: Re: Hash keys reference
by japhy (Canon) on Mar 04, 2002 at 03:30 UTC
    Yes, I'm fully aware of that, which is why I used the example. ;)

    _____________________________________________________
    Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a (from-home) job
    s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;