Actually what I meant was, does the regex itself work. 
If the regex structure is bad then using it in vars won't work either.

Always a good principle of programming : 
        If you can't do it dynamically make sure it works static.

Instead of trying to use(1|2) type you could create a hash from a file or database
Then do :

%names = (
        Orig => New,
        Orig2 => New2,
);

$names{$input_orig} = $input_new;
$names{'orig4'} = 'new4';

foreach $name(keys %names) { s/$name/$names{$name}/g; }

#that would substitute 4 original values with four new values


-----Original Message-----
From: Adriano Allora [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, December 29, 2002 5:21 AM
To: [EMAIL PROTECTED]
Cc: Dan Muey
Subject: Re: single quote and substitutions



Venerd́, 27 Dic 2002, alle 20:11 Europe/Rome, Dan Muey ha scritto:

> Have you tried doing the regex without the vars? 
> s/(name1|name2)/(surname1|surname2)/g;
> Does that do what you want?

I'd prefer do not do it in this way, because I don't know how many (and 
what kind of) $originals and $news I'll have.
My aim is to create a regexp to extract by another file the lists and 
to use them in this script.


> This may work, try :
>
> {
> s/$original/$new/g;
> print;
> }
>

oooh! It's always the same thing: when there's a better way to do 
something it's always the simplier too.

all'adr


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

Reply via email to