SystemVerilog is a compiled language (like C); you cannot build hierarchical references to signal name identifiers from strings. I suggest you use your text editor to replicate the lines of code.
There are other tool specific mechanisms to access signal names by string, but not very efficient. Check with your vendor.
Thank you so much for your quick response Dave…
I have got a reference where you have told the below in one of the past post. I felt bit of contradiction. So asking to clear my doubt.
If you want to keep the continuous assignment, then you need to use $sformatf
generate
for (ganvar num = 0; num < 12; num++) begin
assign hello_if.fruit[num] = $sformatf(“`HELLO.fruit_num%0d”, num);
end
endgenerate