View Full Version : An easy one, I assume. Help me out!

09 September 2005, 11:23 PM
Hey guys,

I'm new to MEL, so excuse the stupid question:

If I, for example, want to make a procedure that takes two incoming strings, and then mashes them together and makes a variable out of their names, how would I do that?

For instance:
If you were to say mashUp("hall_", "oates");
then the mashUp proc would create a variable called $hall_oates ...

I don't need to do precisely that, but it's the only way I know how to ask the question. I need to create and refer to variables, but not explicitly...

Does that make any sense? Thanks!!


09 September 2005, 10:49 AM
the eval command might help you out, something like this:

$string1 = "hall";
$string2 = "oates";
$string3 = "test";

eval("$" + $string1 + "_" + $string2 + " = \"" + $string3 + "\"");

print $hall_oates;

good luck!


CGTalk Moderation
09 September 2005, 10:49 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.