RosettaCodeData/Task/Substring/Perl-6/substring.pl6

9 lines
192 B
Raku
Raw Permalink Normal View History

2013-04-11 01:07:29 -07:00
my $str = 'abcdefgh';
my $n = 2;
my $m = 3;
say $str.substr($n, $m);
say $str.substr($n);
say $str.substr(0, *-1);
say $str.substr($str.index('d'), $m);
say $str.substr($str.index('de'), $m);