Adriano Allora wrote:
> 
> Hi to all,

Hello,

> I feel myself very stupid, but I've tried to do it in different ways
> and I cannot do it.
> I need to clear a text, to tokenize it, for instance to delete some
> things and to transform some others:
> .. at this time I use this regexp:
> a) to delete
> s/=+\n//g;
> s/-+\n//g;
> 
> b) to transform
> s/-+/-/g;
> s/\*+/\*/g;
> s/\^+/\^/g;
> s/\_+/\_/g;
> s/ +/ /g; (this one doesn't works very well: at the end there are
> several blank spaces)
> 
> and I used this one: s/\s+/ /g; but I understand this is not very
> useful: I need to change a multiple \n|\r|\t|\f in a single \n|\r|\t|\f.
> 
> BUT, when I try to create an array (@tochange = ("-", "\*", "\^", "\n",
> "\t","\r","\f","\+","\_","="," "); and I also used a my
> $tochange="...";) the regexp s/$tochange+/$tochange/g; does not work.


If you want to transform multiple characters to a single character:

$ perl -le'
$_ = q/----***^^^____^^^^****---___/;
print;
tr/-*^_//s;
print;
'
----***^^^____^^^^****---___
-*^_^*-_




John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to