How can I assign a combination of string and a variable to another variable?
For example, I need to prepare a piece of code that I need to write in a file based on the if condition match. Here $mod and $param are variables and rest of them is just plain text that I need to write in a file.
$mode = "abc";
$param = "parameter";
if (${mod} == "xyz") {
$tmp_var = $mod #(
$param
) func_cell
(/*AUTO*/);
} else {
$tmp_var = $mod func_cell
(/*AUTO*/);
}
# Here I will write `$tmp_var` inbetween other text in my file.
If I run above code, I see syntax errors like (Missing semicolon on previous line?). I am new to Perl. Can someone help me fixing the syntax?
${mod}is presumably${mode}, right? Or do you have both$modand$mode?${mod}instead of$mod.