in reply to Use scalars to define a filename

The code you have does not result in that error. The code you have does result in a *different* error under use strict, though.

"fileLocn/$var1_$var2.txt"
is the same as
"fileLocn/" . $var1_ . $var2 . ".txt"

The problem being that there is no variable $var1_. Fix:

"fileLocn/${var1}_$var2.txt"

[ Whoa! three people posted more or less the same while I was typing this! ]