in reply to Re: Re: Re: Hash slices ?
in thread Hash slices ?

Poppycock! That is such an outrageous statement I don't really know where to start.

If we are to take "same as" in some comment in some sample code and extrapolate fundamental behavior from it... So since "same as" has such profound meaning, then it must also be true that these two are "the same":

@days{@x,@y} ($days{@x},$days{@y})
or even these:
@days{foo(),bar()} ($days{foo()},$days{bar()})
when in fact, they aren't.

The fact is that a hash slice in a scalar context returns the last item of the hash slice because there is C code that specifically does that. What you quoted doesn't qualify as documentation of that fact. If that is the only documentation, then it is undocumented.

In fact, Perl actually goes though and builds the entire list result of the hash slice and then moves the last item to the front:

unlike many "list-returning operations" that know to optimize their behavior in the face of scalar context. And all of this has very little to do with the comma operator which you claim it is "documented" as being "same as".

        - tye (but my friends call me "Tye")