in reply to eval function
Oh, and maybe you're missing the difference between single quotes and double quotes? I'm not sure, but if you wanted to get "$data{value} abcd.1000.xyz", then you should use double quotes instead of single quotes in the 3rd line.
Apart from that, I don't understand what you expect to accomplish with that eval statement.
Sorry -- I think I get it now. You want to put a variable name into a string assignment, then later on, you want to assign a value to a variable having that name, and have it interpolated into the string.
There's a better way to do that:
$data{value} = 'abc.VALUE.xyz'; sub process_value { my $digit = 1000; $data{value} =~ s/VALUE/$digit/; print "\$data{value} $data{value}\n" } process_value();
|
|---|