in reply to How do I insert (not overwrite) into a string?
KM: substr($_,0,0,"H")
Ovid: s/^(.*)$/H$1/
Shendal: $_ .= "H".$_
turnstep: s/^/H/
Benchmark: timing 100000 iterations of KM, Ovid, Shendal, turnstep... KM: -1 wallclock secs ( 0.55 usr + 0.00 sys = 0.55 CPU) Ovid: 2 wallclock secs ( 2.20 usr + 0.00 sys = 2.20 CPU) Shendal: 0 wallclock secs ( 0.53 usr + 0.00 sys = 0.53 CPU) turnstep: 1 wallclock secs ( 0.98 usr + 0.00 sys = 0.98 CPU)
Cheers,
KM
|
---|