Re: [OT] Perl: exec and $variables

2001-07-22 Thread Sven Burgener
On Sat, Jul 21, 2001 at 04:53:35PM +0200, Joost Kooij wrote: What is the need for the seperate variable $BEGINREGEX? It complicates things enormously when you want a variable $no to be evaluated whenever $BEGINREGEX is evaluated. The only sane way out is to completely reevaluate $BEGINREGEX

Re: [OT] Perl: exec and $variables

2001-07-22 Thread Sven Burgener
On Sat, Jul 21, 2001 at 10:36:55AM -0500, Andrew Perrin wrote: my $template = '^!-- // begin of news%no% // !--$'; my $no = 99; my $bla = $template; $bla =~ s/%no%/$no/g; $replace{no} = 99; $bla =~ s/%(.+?)%/$replace{$1}/g; Disclaimer: these are trivial and not terribly robust

[OT] Perl: exec and $variables

2001-07-21 Thread Sven Burgener
Hello I have a problem with some perl code. I know this is off-topic, but there are numerous knowledgeable people on deb-usr, so forgive me for posting this. Now to my problem. Given the following variable, my $BEGINREGEX = sprintf(\^!-- // begin of news\$no // !--\$\); the following eval()

Re: [OT] Perl: exec and $variables

2001-07-21 Thread Joost Kooij
On Sat, Jul 21, 2001 at 01:04:40PM +0200, Sven Burgener wrote: I have a problem with some perl code. I know this is off-topic, but there are numerous knowledgeable people on deb-usr, so forgive me for posting this. Now to my problem. Given the following variable, my $BEGINREGEX =

Re: [OT] Perl: exec and $variables

2001-07-21 Thread Sven Burgener
On Sat, Jul 21, 2001 at 01:46:25PM +0200, Joost Kooij wrote: On Sat, Jul 21, 2001 at 01:04:40PM +0200, Sven Burgener wrote: my $BEGINREGEX = sprintf(\^!-- // begin of news\$no // !--\$\); Please tell us what you're trying to accomplish first. It is unclear what assumptions you are

Re: [OT] Perl: exec and $variables

2001-07-21 Thread Andrew Perrin
eval() doesn't do what you want - it *executes* code, as opposed to substituting values for variables. Try something like: my $template = '^!-- // begin of news%no% // !--$'; my $no = 99; my $bla = $template; $bla =~ s/%no%/$no/g; You can get fancy too, if you want: $replace{no} = 99; $bla =~

Re: [OT] Perl: exec and $variables

2001-07-21 Thread Joost Kooij
On Sat, Jul 21, 2001 at 02:31:58PM +0200, Sven Burgener wrote: On Sat, Jul 21, 2001 at 01:46:25PM +0200, Joost Kooij wrote: On Sat, Jul 21, 2001 at 01:04:40PM +0200, Sven Burgener wrote: my $BEGINREGEX = sprintf(\^!-- // begin of news\$no // !--\$\); Please tell us what you're trying