in reply to Autovivification and hash slices

You ignore that join also has a prototype. When you write
join @_;

Then the @_ is evaluated in scalar context as the separator, with an empty list of items to join.

So join and myjoin evaluate their arguments differently, and it's no surprise that they lead to difference in autovivification.

Replies are listed 'Best First'.
Re^2: Autovivification and hash slices
by norbert.csongradi (Beadle) on Aug 17, 2011 at 13:04 UTC

    OK, but how to fix that and how can I avoid autovivification of the original hash?

    return (join (@_)); Same result.

    return join {@{\@_}) Same result.

    my ($sep, @a) = @_; return join($sep, @a);
    More warnings, but same result (original hash modified, but shouldn't).