void rmsp(SV * sv) { char * end; int length; if( !SvPOK(sv) ) return; end = SvEND(sv); length = SvCUR(sv); end--; /* skip \0 */ while( *end == ' ' && length >=0 ) { end--; length--; } if( length >= 0 ) SvCUR_set(sv, length); } #### Benchmark: timing 1000000 iterations of inline, regex... inline: 6 wallclock secs ( 4.19 usr + 0.01 sys = 4.20 CPU) regex: 9 wallclock secs ( 7.71 usr + 0.02 sys = 7.73 CPU)