| 1 | use Test::More qw(no_plan); |
| 2 | use strict; |
| 3 | use warnings; |
| 4 | use autobox::Core; |
| 5 | |
| 6 | my $s = "The black cat climbed the green tree"; |
| 7 | my $color = $s->substr(4, 5); |
| 8 | |
| 9 | is $color, 'black'; |
| 10 | |
| 11 | my $middle = $s->substr(4, -11); |
| 12 | |
| 13 | is $middle, 'black cat climbed the'; |
| 14 | |
| 15 | my $end = $s->substr(14); |
| 16 | is $end, 'climbed the green tree'; |
| 17 | |
| 18 | my $tail = $s->substr(-4); |
| 19 | is $tail, 'tree'; |
| 20 | |
| 21 | my $z = $s->substr(-4, 2); |
| 22 | |
| 23 | is $z, 'tr'; |
| 24 |