in reply to Use scalars to define a filename
The underscore is a legitimate character in a variable name,so you'll have to create to the file in one of the following ways
Or one a a myriad othersmy $fileName = "fileLocn/".$var1."_$var2.txt"; my $fileName = "fileLocn/${var1}_$var2.txt"; my $fileName = sprintf("fileLocn/%s_%s.txt", $var1, $var2);
print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."
|
---|
In Section
Seekers of Perl Wisdom