in reply to cgi output.

Yes, you can. Feel free to try it.

Note that you might have to be slightly explicit about the variable name, in case you want to interpolate the variable into a string with lots of other text. If you have a variable called $filename and you want to add numbers to the end, you will have to say:

print "${filename}1.jpg";

and so forth.