File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -401,19 +401,19 @@ one parameter vary according to the earlier parameters. For example,
401
401
print "$first_name $surname is known as \"$nickname\"";
402
402
}
403
403
404
- A default value expression can also be written using the C<//=> operator,
405
- where it will be evaluated and used if the caller omitted a value or the
406
- value provided was C<undef>.
404
+ Since Perl 5.38, a default value expression can also be written using the
405
+ C<//=> operator, where it will be evaluated and used if the caller omitted
406
+ a value or the value provided was C<undef>.
407
407
408
408
sub foo ($name //= "world") {
409
409
print "Hello, $name";
410
410
}
411
411
412
412
foo(undef); # will print "Hello, world"
413
413
414
- Similarly, the C<||=> operator can be used to provide a default
415
- expression to be used whenever the caller provided a false value (and
416
- remember that a missing or C<undef> value are also false).
414
+ Similarly since Perl 5.38 , the C<||=> operator can be used to provide a
415
+ default expression to be used whenever the caller provided a false value
416
+ (and remember that a missing or C<undef> value are also false).
417
417
418
418
sub foo ($x ||= 10) {
419
419
return 5 + $x;
You can’t perform that action at this time.
0 commit comments