On Sat, Jul 21, 2001 at 10:36:55AM -0500, Andrew Perrin wrote:
> my $template = '^$';
> 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 solutions; take them
> as a s
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 $BEGINREG
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(\"^\$\")";
> >
> > Please tell us what you're trying to accomplish firs
eval() doesn't do what you want - it *executes* code, as opposed to
substituting values for variables. Try something like:
my $template = '^$';
my $no = 99;
my $bla = $template;
$bla =~ s/%no%/$no/g;
You can get fancy too, if you want:
$replace{no} = 99;
$bla =~ s/%(.+?)%/$replace{$1}/g;
now
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(\"^\$\")";
>
> Please tell us what you're trying to accomplish first. It is unclear
> what assumptions you are making.
What I want is the
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
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(\"^\$\")";
the following eval() call doesn't substitute $no
7 matches
Mail list logo