A
Andrew R. Gillett
Being a Perl newbie, I may be doing something very simple wrong here. The
following line doesn't seem to work as I expect it to:
print FILEHANDLE 'Thing:\n' . $var1 . '\n' . $var2;
The desired output (if var1 = Hello and var2 = Goodbye) is:
Thing:\nHello\nGoodbye
But what I actually get is this:
Thing:\nHello
\nGoodbye
The most likely explanation is that var1 has a newline in it (the text is
read in from a file). I tried stripping \n from the variable, it didn't
work but I'm not sure if this is the right way to do it:
$var1 =~ s/"\n"//;
following line doesn't seem to work as I expect it to:
print FILEHANDLE 'Thing:\n' . $var1 . '\n' . $var2;
The desired output (if var1 = Hello and var2 = Goodbye) is:
Thing:\nHello\nGoodbye
But what I actually get is this:
Thing:\nHello
\nGoodbye
The most likely explanation is that var1 has a newline in it (the text is
read in from a file). I tried stripping \n from the variable, it didn't
work but I'm not sure if this is the right way to do it:
$var1 =~ s/"\n"//;