>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 $_
tr/// does not admit character classes!
The "leading" thing can be effected with \G. For example:
s/\G /0/g; # change leading blanks to 0
In general, getting folks to write
s/^\s+//s;
s/\s+$//s; # XXX: \z
is a *good* think.
--tom
- Re: Proposal: chop() dropped Jonathan Scott Duff
- RE: Proposal: chop() dropped Eric Roode
- Re: Proposal: chop() dropped Eric Roode
- Re: Proposal: chop() dropped Nathan Torkington
- Re: Proposal: chop() dropped Dan Zetterstrom
- Re: Proposal: chop() dropped Dan Zetterstrom
- Re: Proposal: chop() dropped Jonathan Scott Duff
- Re: Proposal: chop() dropped Buddha Buck
- Re: Proposal: chop() dropped Jonathan Scott Duff
- Re: Proposal: chop() dropped Tom Christiansen
- Re: Proposal: chop() dropped Tom Christiansen
- Re: Proposal: chop() dropped Eric Roode
- Re: Proposal: chop() dropped Tom Christiansen
- Re: Proposal: chop() dropped Bart Lateur
- Re: Proposal: chop() dropped Eric Roode
- Re: Proposal: chop() dropped Tom Christiansen
- Re: Proposal: chop() dropped Bart Lateur
- Re: Proposal: chop() dropped Tom Christiansen
