It looks like you are confusing the "string form" of eval with the "block form". Try perldoc -f eval to get the full story, and then merlyn's comment may be clearer. To do what you want to do, you need something like
where $_ contains your 'test_string_$val'. But as Roy already pointed out, this may not be a very wise thing to do in the first place.$string = eval qq("$_");
the lowliest monk
In reply to Re^3: How to evaluate a variable in a text string
by tlm
in thread How to evaluate a variable in a text string
by tariqahsan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |