Substring/Top and tail: Difference between revisions

Content added Content deleted
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
m (→‎{{header|Raku}}: Fix link: Perl 6 --> Raku)
Line 1,439: Line 1,439:
(formerly Perl 6)
(formerly Perl 6)


Perl 6 provides both functional and method forms of substr. Note that, unlike in Perl 5, offsets from the end do not use negative numbers, but instead require a function expressing the negative offset relative to the length parameter, which is supplied by the operator. The form <tt>*-1</tt> is just a simple way to write such a function.
Raku provides both functional and method forms of substr. Note that, unlike in Perl 5, offsets from the end do not use negative numbers, but instead require a function expressing the negative offset relative to the length parameter, which is supplied by the operator. The form <tt>*-1</tt> is just a simple way to write such a function.


We use musical sharps and flats to illustrate that Perl is comfortable with characters from any Unicode plane.
We use musical sharps and flats to illustrate that Raku is comfortable with characters from any Unicode plane.


<lang perl6>my $s = '𝄪♯♮♭𝄫';
<lang perl6>my $s = '𝄪♯♮♭𝄫';