The people who tell you to
use strict etc really do have your best interests at heart, even though it may seem like they're trying to score off you without answering your question. It's like if you saw somebody climbing up the outside of a house and he calls out
"can you throw me up a hatchet so I can cut away this bunch of ivy that's getting in my way" ...
you might well say,
"hey, no, come down here, and then go inside and you'll find there's a staircase that will take you where you want to go".
(Also, if you'd seen a lot of people climbing the outside of the building and falling off and eventually going into the staircase, you might get a bit short with them.)
As to specific problems with the above, I would think
particle is correct - and indeed you do it "right" in your line 2, where you have
${"NEW_BUS_TXT$x"}.
But I say ' "right" ' rather than 'right' advisedly. The Camel says of symbolic references, which is what you're doing, "very powerful, and slightly dangerous". And I think in this case you probably don't need the power, and you certainly don't need the danger.
I haven't quite figured out exactly what you are trying to achieve, but I guess you have somewhere a lot of defined variables called things like
$NEW_PD1, $NEW_PD2, each of which is the html for a pull down menu.
Now the first thing I'd say is that if that's correct you would in general be far better off putting those values an array, and iterating through the array.
BUT... in this specific instance
what I would really recommend would be using CGI.pm.
As you may know, this industry-standard module has lots of great functions which,
inter alia allow you to generate pull down menus (
popup_menu()) on the fly.
Without knowing more about what you want to put into these menus, I can't give you any example code that will be any use; but I am quite certain that using CGI in this way would save you a lot of trouble. Even if you've never used this module before (even if you've never used any module before) you would find that it repays your effort in learning to get it working.
Take a look in
http://cpan.valueclick.com/modules/by-category/15_World_Wide_Web_HTML_HTTP_CGI/CGI/CGI.pm-2.80.tar.gz to see the documented code, or use
Super Search here to find resources to help you do this if needs be.
It wd be very interesting to see what you produce if you decide to go this way, and monks will be delighted to help you perfect it, I doubt not.
§
George Sherston