[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[OT] Perl: exec and $variables



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() call doesn't substitute $no for what it is and
return the new string with the substituted $no in it:

my $no = 1;
my $bla = eval($BEGINREGEX);
print "$bla\n";

$bla is empty for some reason.

So how would I go about having $no substituted in $BEGINREGEX for
whatever it happens to be set to at a particular point in the script?

Cheers!
Sven
-- 
The best way to escape from a problem is to solve it. 



Reply to: