use Benchmark; $s=($" x 1000)."test"; sub a { $_=$s;s/^ +//; } sub b { $_=$s;while(index($_, " ") == 0) { $_ = substr($_, 1) }} timethese(10000, {a=>\&a,b=>\&b}); Ergebnis: Benchmark: timing 10000 iterations of a, b ...         a:  0 wallclock secs ( 0.06 usr +  0.00 sys =  0.06 CPU) @ 166666.67/s (n=10000)            (warning: too few iterations for a reliable count)         b: 10 wallclock secs ( 9.18 usr +  0.00 sys =  9.18 CPU) @ 1089.32/s (n=10000)