# New Ticket Created by  Aleks-Daniel Jakimenko-Aleksejev 
# Please include the string:  [perl #131111]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=131111 >


Code:
my @a = <a b c>;
my @b = <1 2 3>;
my @c = @a, @b;
say @c

Result:
[[a b c] [1 2 3]]


So with arrays, nothing is flattened and you get an array with two elements. 
Makes sense.

And if we want to get a different behavior, we can use slip:

Code:
my @a = <a b c>;
my @b = <1 2 3>;
my @c = |@a, |@b;
say @c

Result:
[a b c 1 2 3]


Everything is fine so far. Now, let's try the same thing with hashes:

Code:
my %a = <a b c d>;
my %b = <1 2 3 4>;
my %c = %a, %b;
say %c

Result:
{1 => 2, 3 => 4, a => b, c => d}


To me that looks like an inconsistency, I would have expected it to create a 
hash with one pair (%a => %b). In fact, both 「%c = %a, %b」 and 「%c = |%a, |%b」 
work exactly the same!

The idea of %a => %b may seem weird, but it really isn't if you consider object 
hashes (my %c{Hash} = %a => %b; or even my %c{Hash} = $%a, $%b)

Another thing to note is that this array behavior was changed during the GLR, 
but hashes remained the same. Perhaps that was an oversight.

Reply via email to