1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
use warnings; use strict; use Test::More tests => 6; our $t; $[ = 3; $t = "abcdef"; is substr($t, 5), "cdef"; is $t, "abcdef"; $t = "abcdef"; is substr($t, 5, 2), "cd"; is $t, "abcdef"; $t = "abcdef"; is substr($t, 5, 2, "xyz"), "cd"; is $t, "abxyzef"; 1;