User Profile
Collapse
-
Thanks jeff ,
and print " $Hash{$type};"; was a typing mistake.
And what actually my problem is that i want to make the code more generic and to do that i use the variable inside the hash and i replace that variable at the runtime.
So, because of this reason i cant hard code the $type before the hash.
What i want is something like if i can some how refer to the variable and can change the value...Leave a comment:
-
How to replace the predefined variable which is set after the decleration
I have a hash , and in the value part of that (which is a string , So that variable interpolation can happen) i have used a variable .
Now later in the program i set this variable and try to substitute the value of it in the value of hash but it is returning null;
Code:%Hash=('add'=> " test $type "); $type = 1000; print " $Hash{$type};";
No activity results to display
Show More
Leave a comment: