in reply to Re: using hash uniqueness to find the odd man
in thread using hash uniqueness to find the odd man

my code is roughly the same -
s/$seen{$_}++/$seen{$_} = 1;/
almost the same,right?

humbly,
novitiate

"...goodnight you princes of main(e)"  --The Cider House Rules
  • Comment on Re: Re: using hash uniqueness to find the odd man

Replies are listed 'Best First'.
Re^3: using hash uniqueness to find the odd man
by tadman (Prior) on Jul 11, 2001 at 06:04 UTC
    I would recommend using $seen{$_}++ over $seen{$_}=1 because with the former you have additional information, such as how many times you have seen that particular item. This can be useful for detecting duplicate keys, for example.

    As such, these two are perhaps functionally the same in a narrow set of circumstances. Using the ++ approach is much more adaptable, so it should be used in preferance to simple assignment.