I still think its the former.
Given that
%data = << why dunno who them where there which this >>;
I would assume that writing *%data in any context is equivalent to writing
(why => "dunno", who => "them", where => "there", which => "this")
So assuming we can use this as an lvalue, an assignment with a list of pairs to this would be the same as taking each pair and assigning it to the value with the specific key. So
*%data = *%values should be compiled as
multi sub infix:=(List of Pair @assign is rw, List of Pair @values) re
+turns List of Pair {
my %assign := *@assign;
for @values {
%assign{.key} = .value;
}
return *%assign;
}
Let me take another example and go back to part(). We could write:
my $fish = "hest";
($sheep, $goats, $fish) := part Animal::Cat, @animals;
So the question here is, is $fish eq "hest" after this, or undef?
Alternatly we could have written
my $hest = "hest";
%result := ($sheep, $goats, fish => $hest) := part Animal::Cat, @anima
+ls;
Would that give the same result?
Update: Forgot the multi keyword
Update: As broquaint pointed out below, I forgot to use the binding operator as I indented to...
Update: And the second example is completly bogus, because it would endeed result in a compile time error. Was
($sheep, $goats, $fish => "hest") := part Animal::Cat, @animals;
T
I
M
T
O
W
T
D
I
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.