On Mon, Sep 04, 2023 at 06:25:57PM +0300, Ivan Vorontsov wrote: > > 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 don't understand what you are trying to say there. The difference between a mandatory and optional argument is that perl will croak() if not enough mandatory arguments are passed to the function. Given f($x, $y //= 1, $z = 2) # $y is optional parameter what do you expect the result to be for each of these (i.e. croak, or $y assigned the value 2, or whatever)? f(1); f(1,2); f(1, undef); f(1, 2, undef); -- Monto Blanco... scorchio!Thread Previous | Thread Next