G
goomania
I am using Perl on Unix to process some data file I got from others.
Data are broken into and displayed on separate lines . However, when I
tried to use code as:
#####################################################################
@lines = split("\n", $text);
# $text is the variable where I stored the content of the data file
print "@lines\n";
#####################################################################
to parse the different lines of data file to the array @lines, the
output are not the same as the original data file.
Then I found out that, after I opened the data file with emacs and read
the file content, there are characters of "^M" appended to end of each
line of the file. "^M" is invisible if I read the file by unix "more"
command.
Can anyone please tell me what are those "^M" for and how to use Perl
to handle files with such special characters rather than standard ones
like "\n" for newline on Unix?
Thanks a lot for your help!
Andy
Data are broken into and displayed on separate lines . However, when I
tried to use code as:
#####################################################################
@lines = split("\n", $text);
# $text is the variable where I stored the content of the data file
print "@lines\n";
#####################################################################
to parse the different lines of data file to the array @lines, the
output are not the same as the original data file.
Then I found out that, after I opened the data file with emacs and read
the file content, there are characters of "^M" appended to end of each
line of the file. "^M" is invisible if I read the file by unix "more"
command.
Can anyone please tell me what are those "^M" for and how to use Perl
to handle files with such special characters rather than standard ones
like "\n" for newline on Unix?
Thanks a lot for your help!
Andy