Re: Using variables in replacement in substitutions

2004-11-20 Thread Robin
On Thu, Nov 18, 2004 at 04:28:40PM +0100, Markus Treinen wrote: > I can't use strict because I simple add a config-file via require and > the variables are simply declared (without my or our). And as it gives > me a lot of warnings, I disabled them, too :-) I hit this very thing today, so I cheat

Re: Using variables in replacement in substitutions

2004-11-19 Thread Peter Scott
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Markus Treinen) writes: >> Then don't interpolate it beforehand. (Didn't you get a warning >> about "use of uninitialized value"?) >I can't use strict because I simple add a config-file via require and >the variables are simply declared (without

Re: Using variables in replacement in substitutions

2004-11-18 Thread Gunnar Hjalmarsson
Markus Treinen wrote: Peter Scott wrote: Then don't interpolate it beforehand. (Didn't you get a warning about "use of uninitialized value"?) I can't use strict because I simple add a config-file via require and the variables are simply declared (without my or our). And as it gives me a lot of war

Re: Using variables in replacement in substitutions

2004-11-18 Thread Markus Treinen
Then don't interpolate it beforehand. (Didn't you get a warning about "use of uninitialized value"?) I can't use strict because I simple add a config-file via require and the variables are simply declared (without my or our). And as it gives me a lot of warnings, I disabled them, too :-) But I c

Re: Using variables in replacement in substitutions

2004-11-18 Thread Peter Scott
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Markus Treinen) writes: >Hi, >I have the following case: > >- >my $reg_exp = qr/^ONE\.(\d{6})\.THREE$/; >my $replace_with = "FOUR.$1.FIVE"; > >my $example_file = "ONE.123456.THREE"; >$example_file = s/$reg_exp/$replace_with/; >- > >In word

Using variables in replacement in substitutions

2004-11-18 Thread Markus Treinen
Hi, I have the following case: - my $reg_exp = qr/^ONE\.(\d{6})\.THREE$/; my $replace_with = "FOUR.$1.FIVE"; my $example_file = "ONE.123456.THREE"; $example_file = s/$reg_exp/$replace_with/; - In words, I want to reuse substrings from the matched string in the replacement string. Both rege