Thank you, okol. I like the simplicity of your suggestion, but it doesn't work the way you showed it (I added the 3 lines you mentioned right after the last EOF (curly bracket seems unnecessary) and it gave me syntax error at the str3=$... line). However, even if it did work, I would like something more generic and not code dependent: if I remove 'print' statement from the perl block, your 'str3=' line would fail.