Home : General : Perl Programming :

General: Perl Programming: Search and replace using tr//c: Edit Log

Here is the list of edits for this post
Search and replace using tr//c
I've been playing around with this bit, but can't quite seem to get the last part right.

$checkit = "tony!|bob&sue|me@me.com";

$checkit =~ tr/[A-Za-z0-9][ ][.][|]/\*/c;

I've got it matching all non-character, non-numeric (except for space, period and pipe).

I want to replace the non-items with a backslash and the non-item. (tony\!|bob\&sue|me\@me.com).

I can't seem to figure out what to use where the * is in the tr// bit. I tried $1 (and about 6 million other things) but that didn't work.

Any suggestions?

Last edited by:

Watts: Dec 15, 2003, 2:11 PM

Edit Log: