Re: opening a file
- From: cartercc <cartercc@xxxxxxxxx>
- Date: Thu, 8 Jan 2009 06:33:46 -0800 (PST)
On Jan 7, 9:50 pm, George <geo...@xxxxxxxxxxxxxxx> wrote:
I thought I would use perl instead of fortran to parse a text file, what
with the new m// s/// capabilities at my fingertips.
Easy, easy, easy ...
open INFILE, "<nameoffile.txt";
while (<INFILE>) {print;}
close INFILE;
This creates the handle INFILE for the named file in your current
directory and cycles through it line by line, printing each line. To
write the file to an out handle, do this:
open INFILE, "<nameoffile.txt";
open OUTFILE, ">nameofnewfile.txt";
while (<INFILE>) { print OUTFILE;}
close OUTFILE;
close INFILE;
CC.
.
- Follow-Ups:
- Re: opening a file
- From: Jürgen Exner
- Re: opening a file
- References:
- opening a file
- From: George
- opening a file
- Prev by Date: Re: mail address validation
- Next by Date: Re: loops in perl automated ftp
- Previous by thread: Re: opening a file
- Next by thread: Re: opening a file
- Index(es):
Relevant Pages
|