|Do you know where your variables are?|
Is there a question here ?
Please see Writeup Formatting Tips for information on how to post code correctly.
You may also want to read up on how to use Arrays in perl. Information on this is available by typing "perldoc perlintro".
I would also recommend adding the following to the top of every program you write:
If you need assistance debugging pyour program, please show the content of the file "b.txt" (at least the first few lines).
It appears that you want to process a template with some data. An experienced programmer would use something like Template::Toolkit.
"By three methods we may learn wisdom: First, by reflection, which is noblest; Second, by imitation, which is easiest; and third by experience, which is the bitterest." -Confucius