> -----Original Message-----
> From: Hanson, Rob [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, 24 February 2004 5:43 AM
> To: 'Olivier Wirz'; [EMAIL PROTECTED]
> Subject: RE: substitution
>
> > Is it possible to do this
>
> No, at least not the way you are doing it.
>
> Something like this will work (untested)
>
> my %replacements = (ARE => 756, TYP => 978, SPE => 840);
> $marque =~ s/(ARE|TYR|SPE)/$replacements{$1}/;
>
> Rob
>
Close, you need the /e option to enable evaluation of the
replacement string, and /g for good measure.
my %replacements = (ARE => 756, TYP => 978, SPE => 840);
$marque =~ s/(ARE|TYR|SPE)/$replacements{$1}/eg;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>