$ time perl -e '$a = "a" x 50_000; substr($a, 0, 1, "") while length($a);' real 0m0.016s user 0m0.012s sys 0m0.008s ysth@cat:~$ time perl -e '$a = "a" x 100_000; substr($a, 0, 1, "") while length($a);' real 0m0.029s user 0m0.024s sys 0m0.004s ysth@cat:~$ time perl -e '$a = "a" x 200_000; substr($a, 0, 1, "") while length($a);' real 0m0.041s user 0m0.036s sys 0m0.004s