> f($x, $y //= 1, $z = 2) # $y is optional parameter This is an intermediate case. To a caller $y is optional, but $y must have undef value either explicitly or implicitly to trigger the assignment, $z must not accept argument at all to get assigned. I would call $y semi-optional :) > I think //= and ||= should be consistently either mandatory or optional, > and not vary based on context. I think that it doesn't matter whether a parameter is mandatory or optional. //= and ||= operators work by checking a value. It's a conditional assignment to a variable that must already have a value to be examined. It is a nice feature to have, a convenient shortcut, which now works only in case of optional parameters. If it can't be done, it's okay. I can write the check explicitly (as usual :)): sub foo ($x, $y, $z) { $y //= 42 } -- Ivan Vorontsov <ivrntsv@yandex.ru>Thread Previous | Thread Next