in reply to postfix incrementing of hash slice

"A hash element with a value of undef is apparently different that a hash element that has never been created."
I wonder if you really mean 'value' here. I often use the following when I want a look-up table:
@hash{@array}=(undef) x @array;
To find if a key exists use 'exists', to find if a key has a value use 'defined'.
%hash = undef; produces a hash with a single (weird) key which is undef, and no values (the correct way to get rid of a hash is undef %hash). Every hash value has a key, but not every key need have a value, it can be undef. But there can be only one 'undef' key.

Replies are listed 'Best First'.
Re^2: postfix incrementing of hash slice
by Hue-Bond (Priest) on Oct 01, 2006 at 12:30 UTC
    %hash = undef; produces a hash with a single (weird) key

    The key gets upgraded to a string, so it is really the null string:

    use warnings; use strict; my %hash = undef; use Data::Dumper;print Dumper \%hash; __END__ Odd number of elements in hash assignment at - line 1. Use of uninitialized value in list assignment at - line 1. $VAR1 = { '' => undef };

    --
    David Serrano