Re: learning perl 3rd vs 4th

[email protected] (Matthew Whipple)
Newsgroups perl.beginners
Message-ID <[email protected]>
On Sun, 2008-05-25 at 10:07 -0700, AndrewMcHorney wrote:
> Hello
> 
> I have been reading files with the following command:
> 
> @source_lines = (<SOURCE_FILE>);
> 

You'd want to use 

$source_line = <SOURCE_FILE>

to get a single record at a time from the handle

> This has worked until I started reading some very large files. Is 
> there a better way to read files? The files I am trying to read now 
> are about 300 megabytes in size. The bad news is that the spec has no 
> carriage returns or line feeds. 

perldoc perlvar - Check the section on the input record seperator

> We have no control over the spec. I 
> need to replace a few characters in the file.
> 
> Andrew


If you need more precise control also look into the IO Modules
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.