Why does string concatenation in perl result in two lines, not one?
I am new to perl and am having trouble adding some strings together. My full code is below:
open FinalFileList,"<","finalFileList.txt" || die "could not open file";
open (linkCommands, '>makeLinks.sh');
$myNum = 8;
$NewCommand = "ln -s " . $_;
$NewCommandB = $NewCommand . "/atlas2/hodgkinson/REALDATA_Virtual/data09_900GeV.00141707.physics_MinBias.merge.DESD_COLLCAND.f183_m300/data09_900GeV.00142383.physics_MinBias.merge.DESD_COLLCAND.f190_m311_";
#. $myNum . ".pool.root";
print linkCommands "$NewCommandB\n";
$myNum += 1;
The problem is $NewCommandB is always split into two lines, where the second line contains the "/atlas2/<blah>/<etc>/..." string. Since I am generating a .sh file to execute a lot of similar commands I need the string to all be on one line. Any idea why I get this behaviour and any suggestion on how to tell perl to make $NewCommandB a one line string?
btw for completeness finalFileList.txt contains just file names one line after another: