PERL:How to print the lines of a opening file without '\n' in the end?
Hi all,
I found that while reading a line from a file,perl will add a '\n' in the end when printing this line.
For example:
#!/usr/bin/perl
use strict;
use warnings;
open FILE,"anaconda.cfg" or warn $!;
while(<FILE>){
print "$_.....................";
}
the output is as follows:
# Kickstart file automatically generated by anaconda.
.....................%packages
.....................@admin-tools
.....................@base
.....................@core
.....................
But I don't want this output,I want the ".............."in the end of each lines,as follows:
# Kickstart file automatically generated by anaconda......................%packages.....................@admin-tools.....................@base.....................@core.....................
I think the perl will add '\n' in each line from the file,so how to delete the '\n' character?
Last edited by jimtony; 11-21-2011 at 08:20 PM.
|