September 13th, 2012, 09:32 AM
Problem when printing
hi, i have a problem when i try to print all the variables in the same line. I chomped all the variables but still im getting my variables in different lines.
here is my script:
and here is the result:
print MYFILE "$AEND,$VLAN,$EPTN,$VC,UP,$DESCRIPTION,UP\n";
and even i print the result on the screen im getting this
September 13th, 2012, 01:42 PM
One possible explanation.
Sometimes, chomp does not remove the full carriage return. For example, if your file comes from a Windows box and your program runs on Unix or Linux, you may have this type of problem: perl "knows" it is running on Unix et, therefore, that the new line character is \n. But if your file comes from Windows, the new line is a combination of 2 characters, \r and \n. The chomp function removes \n but leaves the trailing \r.
There might be similar trouble between Mac and Windows, or Mac and Unix.