Skip to content

Commit 2cad4c1

Browse files
rwp0book
authored andcommitted
ppc0013: Use List::Util for reduce
It also fixes GitHub's Markdown's highlighting the Perl code correctly Bump 5.34 to 5.38 since there's still significant progress in this field until now
1 parent 9c6fadc commit 2cad4c1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ppcs/ppc0013-overload-join-and-substr.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
## Abstract
1111

12-
As of Perl version 5.34, `overload` is incomplete and surprising for
12+
As of Perl version 5.38, `overload` is incomplete and surprising for
1313
string operations:
1414

1515
* the `join` builtin should be using the `concat` (`.`) overload
@@ -98,11 +98,14 @@ We do not yet foresee security issues. Guidance is welcome.
9898
For `join`:
9999

100100
```perl
101-
# when @list contains elements with concat overloading,
102-
# we expect this code:
101+
# When @list contains elements with concat overloading, we expect this code:
102+
103103
my $ret = join $sep, @list;
104104

105-
# to behave like this code:
105+
# To behave like this code:
106+
107+
use List::Util 'reduce';
108+
106109
my $ret = reduce { ( $a . $sep ) . $b } @list;
107110
```
108111

0 commit comments

Comments
 (0)