You're missing a couple of things:
- <code> and </code> around your script, so we can read it more easily as code (you've been here long enough now that you should know this)
- a simple, concise statement about what you actually want, and how that's different from what you're getting.
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();
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.