in reply to Re^3: Understanding Perl context (removing duplicates from array)
in thread Understanding Perl context

Hmmm... Hadn't thought about that.

But in the specific case of the OPed code, replacing  undef with 0 (or, indeed, with 1 or any other value) would make no difference: you still end up with a hash of unique keys.

And in the general case, if code did depend on the difference between  undef and 0 as values, would not this dependence be underscored by the explicit use of  undef as the initializer (reinforced, one would hope, by a comment) rather than the more general  () empty list?


Give a man a fish:  <%-(-(-(-<

Replies are listed 'Best First'.
Re^5: Understanding Perl context (removing duplicates from array)
by LanX (Saint) on Apr 19, 2015 at 14:47 UTC
    Sorry, I've had too many coworkers in the past using broken copy and paste code and justifying that the cargo cult worked so far.

    ("Of course it's well tested! I ran it once and nothing bad happened ... " )

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!