if you use an array you are using up memory.
small files are okay for that.. but you can do it in the while loop without
the array.

But TIMTOWTDI.

what are you checking for in the lines? Just an example will tell us what's
best for your application.


> -----Original Message-----
> From: Jerry Preston [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 26, 2002 11:51 AM
> To: [EMAIL PROTECTED]
> Cc: Beginners Perl
> Subject: RE: a better way?
> 
> 
> Jeff,
> 
> I guess it an old 'c' habit.  I do this to check each line 
> for the item I am
> looking for.
> 
> I there a better way and why?
> 
> Thanks,
> 
> Jerry
> 
> -----Original Message-----
> From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 26, 2002 10:36 AM
> To: Jerry Preston
> Cc: Beginners Perl
> Subject: Re: a better way?
> 
> 
> On Sep 26, Jerry Preston said:
> 
> >Is there a better way?  A Perl way?
> >
> >  $j = 0;
> >  while( <file> ) {
> >    chomp;
> >    ( $lots[ $j++ ] ) = $_;
> 
> That's usually written as
> 
>      push @lots, $_;
> 
> >  }
> 
> Well, you could do:
> 
>   chomp(@lines = <FILE>);
> 
> but why do you need the file in an array?
>

----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


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

Reply via email to