in reply to How to deal with undefined returned variables.
knight makes a good point. Fortunately, in Perl 6, there will be a defaulting operator to simplify this very problem.
A binary // operator is the defaulting operator.Perl 6 should be such fun!
That is:is short for:$a // $bexcept that the left side is evaluated only once. It will work on arrays and hashes as well as scalars. It also has a corresponding assignment operator, which only does the assignment if the left side is undefined:defined($a) ?? $a :: $b$pi //= 3;