$proj_lib = "XYZ"; printf $xmlfile "%8s","$proj_name\_lib\n"; Output: " XYZ_lib"