On Fri, Mar 26, 2010 at 12:15:44AM +0100, Rafael Garcia-Suarez wrote: > On 25 March 2010 23:42, smu johnson <smujohnson@gmail.com> wrote: > > Dear p5p, > > > > In a nutshell: For a while, I've been dreaming of having a whitespace > > trimmer in Perl 5. I am writing to state a case for why I believe the > > addition of the Trim::Text core module, OR a {use v5.1x;} new function of > > the Perl 6 trim function could be added to Perl 5 as given/when and say() > > were. > > I'd be more in favor of a new trim() builtin (enabled via feature). Reasons: > - no new modules ! :) > - faster, as it will be an opcode and hopefully not use regexps > > Now, what kind of whitespace should it remove ? WWP6D ? Well, the Perl5 way would be to remove whatever is in the magic variable ${^TRIM_REMOVE}, which is settable from userland. After all, we do want to have enough rope to have situations where trim() doesn't do what you expect it to do, while at the same time make trim() flexible enough to have it play a prominent role in obfuscated code. AbigailThread Previous | Thread Next