in reply to Resolving Imbedded Variables

Things like this are a lot easier if the data is in a hash .... they you can just find your keys and replace with the hash value. Also, regex (see perlre, especially for details about the /e modifier)is the way to go here instead of the substr string walking. You may also want to see if something like Template Toolkit will quit your needs/be easy to implement in your case.
my %data = ( ma_test => 1, mb_test => 'the RTE', ); my $text = 'titl=This is test $ma_test of $mb_test broadcasting system +'; $text =~ s/\$(\w+)/ $data{$1} /g; print $text;
Alternatively, you might want something like this:
my %data = ( ma_test => 1, mb_test => 'the RTE', ); my $text = 'titl=This is test $ma_test blah $x of $mb_test broadcastin +g system'; $text =~ s/\$(\w+)/ exists $data{lc $1} ? $data{lc $1} : '==VARIABLE_N +OT_FOUND==' /eg; print $text;