File: substr.t

package info (click to toggle)
libautobox-core-perl 1.2-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 328 kB
  • ctags: 161
  • sloc: perl: 567; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 397 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use Test::More qw(no_plan);
use strict;
use warnings;
use autobox::Core;

my $s = "The black cat climbed the green tree";
my $color  = $s->substr(4, 5);

is $color, 'black';

my $middle = $s->substr(4, -11);

is $middle, 'black cat climbed the';

my $end = $s->substr(14);
is $end, 'climbed the green tree';

my $tail = $s->substr(-4);
is $tail, 'tree';

my $z = $s->substr(-4, 2);

is $z, 'tr';