On Thu, 31 Aug 2000 09:41:37 -0400 (EDT), you wrotc:

>Nathan Wiger wrote:
>>In a very cool email, Bryan Warnock talked about half a dozen different
>>chop-like functions that are useful but not in core:
>>
>>http://www.mail-archive.com/perl6-language@perl.org/msg01522.html
>>
>>I think chop, champ, chip, and friends should be available via the
>>
>>   use String::Chop;
>>
>>or related module.
>
>
>Useful functions all, no doubt. But I would lobby heavily for a new
>set of names -- ones that can be remembered! Quick -- which trims 
>leading spaces, champ, chump, or chimp?

Why not use the "function" we already got, tr? Something like:

tr///l       # Translate only _l_eading characters matching.
tr///t       # Translate only _t_railing characters matching.

With "Only leading" I mean translate from start/end until you find a
character not matching. Then you can do nifty things such as:

tr/\w//dlt   # Trim all leading & trailing whitespace from $_

Just a random idea...

-DZ
-- 
Tell me your dreams and I will crush them.

Reply via email to