> I have a problem with substitutions... > In the piece of code, here below, > "display $var1, $var"' should be "display val1, val2"; > I don't see why, but the if condition doesn't seems to > work... and if I remove the if condition, the replacement > doesn't occur... Does any of you know why? > > $VarValue{$var1} = "val1"; > $VarValue{$var2} = "val2" > $Cmd = "display $var1, $var2";
The previous line evaluates to 'display , ' when the perl interpreter hits it because it looks for the variables $var1 and $var2, but can't find them, so it uses '' (the string value of undef) instead. You might want to try: $Cmd = 'display $var1, $var2'; Same thing for the hash you're creating... If you want to do what I think you want to do, you need to define that hash as: $VarValue{'$var1'} = 'val1'; $VarValue{'$var2'} = 'val2'; HTH, -dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]