in reply to Use of grep with arrays/hashes

the autoincrement adds one to the hash VALUE.

also read: $hash{$field} = 1; since the original value of $hash{$field} is 0 ( or undef, i forget which ).

Replies are listed 'Best First'.
Re: Re: Use of grep with arrays/hashes
by petdance (Parson) on May 24, 2001 at 02:11 UTC
    A hash value for a key that doesn't exist is referred to as being "undefined". Not surprisingly, the value returned by $hash{"non-existent"} is undef. It's just that undef+1 is 1.

    xoxo,
    Andy

    %_=split/;/,".;;n;u;e;ot;t;her;c; ".   #   Andy Lester
    'Perl ;@; a;a;j;m;er;y;t;p;n;d;s;o;'.  #   http://petdance.com
    "hack";print map delete$_{$_},split//,q<   andy@petdance.com   >