Why isn't there a straight forward answer to trimming a string in PERL? regex speed tests comparing two regexs vs a single regex...i just want a simple trim function that I can count on being there, without defining one myself. CPAN is fine, but what is that module. trim in the core?
one plus one
Shared publicly•View activity
View 3 previous comments
- .trim() is also built-in to Perl6. I wrote the original implementation in PASM, but I suspect it's been rewritten by now as my implementation was a couple of years ago.Nov 18, 2011
- Right, maybe you didn't see my full expanded comment:
looks like .trim is coming in perl 6...so perl5i is portable in a sense....
portable, but forcing the developer to move to perl6/perl5i to get it. (which is best I guess)
CPAN module route seems like it would be an easy and portable way. But you feel silly to import a module just for strip...not to mention outstanding 64bit bug and no maintainer.
going to perl6 isn't a walk in the park conversion, and I'm not familiar with perl5i, but it looks like a nice alternative. Systems are out there with 5.x and they need to continue working. I wonder how perl5i does on all the platforms aix/sun/etc with older 5.x. perl5i and .trim() may be what I have been searching for.
Thanks for the note Curtis, I haven't tried a bit of PASM myself yet, maybe some day.Nov 19, 2011
- Being a Perl programmer has helped me get plenty of trim. What's your problem?Nov 20, 2011
- Yes, being a Perl programmer has caused many a developer to implement their choice of a trim implementation, each in their own code. Did I not expound the point enough?Nov 21, 2011
- You're right, I didn't see your full comment. Now I'm curious to know if my code still survives. I'll have to check :)Nov 21, 2011
- my comment above was meant to be humorous. I'm sorry if I offended anyone.Nov 21, 2011