On Fri, 2006-23-06 at 02:39 -0400, Omega -1911 wrote:
> -Open one file.
> -Read that file.
> --Line one will be assigned to $data1
> --Line two will be " " to $data2
> ..
> --Line five will be " " to $data5
> -- The remaining lines pushed into an array...
> 
> Really appreciate any help you can give!
> 
> -David

Reading the file, non-slurp:

open IN, ...
chomp( my $data1 = <IN> );
chomp( my $data2 = <IN> );
chomp( my $data3 = <IN> );
chomp( my $data4 = <IN> );
chomp( my $data5 = <IN> );
while( <IN> ){
  chomp;
  ...
}
close IN;

I don't know where people got the idea that reading a file one line at a
time is less efficient than slurping it. Both methods use the underlying
OS disk access system calls, where most of the efficiency lies. Unless
you can organize your data on disk to that advantage of more advance
methods, like ISAM or B-trees, just do it the way that makes the most
sense to the program.

Note that these advance methods take advantage of the data having a
certain structure. If your data does have this, these methods are slower
than the general purpose method.


-- 
__END__

Just my 0.00000002 million dollars worth,
   --- Shawn

"For the things we have to learn before we can do them, we learn by doing them."
  Aristotle

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/



-- 
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