develooper Front page | perl.perl6.language | Postings from April 2008

Help understanding syntax in S06 "Pairs as lvalues"

Thread Next
From:
John M. Dlugosz
Date:
April 13, 2008 14:00
Subject:
Help understanding syntax in S06 "Pairs as lvalues"

:(:who($name), :why($reason)) := (why => $because, who => "me");

What do the symbols $name and $reason refer to?  Are they names already in scope?

"Alternately, the my declarator can also force treatment of its argument as a signature."

That would be

my (:who($name), :why($reason)) := (why => $because, who => "me");

which declares $name and $reason, and poises them for aliasing to named return values.  Signatures normally are used as the beginning of functions and introduce local variables.

--John

Thread Next


Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About