I petition you today on a matter beyond my novice ability. What I am trying to do may not even be possible, but here goes, see bolded text for the actual question.
As a part of processing, these variables get populated early in the process
Later in the process, when writing to the logfile, this line of text gets retrieved from a message table and is placed in variable $text$a_test="1"; $b_test="the RTE";
$text='titl=This is test $ma_test of $mb_test broadcasting system';
Attempting to populate variables in retrieved string with those already defined and populated earlier in the process
Iteration 1 prints "result: 1"$start=1; while (index($text,'$',$start) > 0) { $dsign=index($text,'$',$start); $blank=index($text,' ',$dsign); $w=substr($text,$dsign,($blank-$dsign)); ${(substr($w,1,length($w)-1))}=${(substr($w,2,length($w)-2))}; $start = $blank += 1; print " result: ${(substr($w,1,length($w)-1))}\n"; }
Values of resolved variables
print "ma_test: $ma_test\n";
prints out ma_test: 1
print "mb_test: $mb_test\n";
prints out mb_test: the RTE
Create and populate variable $titl with the remaining text in the string
looking for this: This is test 1 of the RTE broadcasting system${(substr($text,0,4))}=substr($text,5,length($text)-5); print " output: $titl\n";
Is it possible to resolve the variables in the text string to the values in $ma_test and $mb_test?
Thank you for any consideration
R_D
In reply to Resolving Imbedded Variables by Red_Dragon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |