This may help..........a very basic file I/O

open(INFILE,"yourfile");
open (OUTFILE,"outfilename");
while ($line=<INFILE>) {
chomp $line;
next if ($line eq "");
print OUTFILE $line;
}

You could also slurp it into an array, but
----- Original Message -----
From: "Kim, Kiseok" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 30, 2002 1:54 PM
Subject: Re: How To Get Rid Of Excess Blank Lines at The End Of File?


> Ofir wrote:
> > Hi all,
> >
> > I have a file in the following format:
> > Line 1
> > Line 2
> > Line 3
> > Line 4
> > Line 1
> > Line 2
> > Line 3
> > Line 4
> > Blank Lines
> > Blank Lines
> >
> > When I read the File, it reads the blank lines too, so I have an excess
> > record at the end.
> > How can I avoid this? How will I get rid of the excess blank lines at
the
> > end of the file?
> >
> > TIA!
> > OFir
> >
> >
> >
>
> while ( <OPENFILE> ) {
>      next /^\s*\n$/;
>      do_with( $_ );
> }
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to