[Date Prev][Date Next][Thread Prev][Thread Next]
[Search]
[Date Index]
[Thread Index]
RE: [FWP] How to do variable interpolation in a tr substitution string
> From: Steven Lembark [mailto:lembark@wrkhors.com]
> Sent: Sunday, February 13, 2000 09:38
> To: fwp@technofile.org
> Subject: Re: [FWP] How to do variable interpolation in a tr
> substitution string
...
> unless you have fun finding an answer...
>
> instead of "tr" use "s":
>
> s/\w/newchar($1)/seg;
>
> would allow you to write your own tr, no? a bit slower than
> blind tr, but think of the possibilities:
>
> s/\w+/sayit( $1 )/seg;
That code might be a lot more fun if you put capturing parentheses in the
regex, so $1 has a useful value.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
==== Want to unsubscribe from Fun With Perl? Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
==== unsubscribe