But you don't really want to do that.{ no strict 'refs'; $temp = ${$var1 . $var2}; }
The reason I want to do this is that I will have a large cgi script with many predefined open file handles. I want the user to select two values from pull down boxes on a web page and then by using these it will use the correct file handle. It could be done with lots of if statements but there must be a better way to do it?If that is what you want, why didn't you just ask that? Now your question is of the form "How do I do X, because I want to do Y, and I might be able to do that with X". Better is to ask "How do I do Y?", because the answer is Z. And Z is "Use a hash". In your case, a 2 dimensional hash. The selected values will be the entries, and the filehandles (or rather, references to them), the values.
Abigail
In reply to Re: Many strings make one variable?
by Abigail-II
in thread Many strings make one variable?
by heezy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |