open F, "file.txt";
my @file = <F>;
chomp @file;

print "@file";
Is that what you want ?

----- Original Message ----- 
From: "Anish Kumar K." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 09, 2004 2:41 PM
Subject: how to skip new line character


Hi All
As a beginner in PERL, I wrote a small program which reads data from the
file and stores in an array. In that process i wanted to skip the new line
character...

for ex: In my program

say "a.txt" contains

man
pan

tan

In the program

open INPUT,"a.txt" or die $!;
my @file = <INPUT>;

when I print the file, I could see $file[2] and $file[4] has only new line
character...

So while I store in the array I should skip this character..I tried chop and
chomp..Not effective....

Thanks
Anish




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to