On 6/23/06, Omega -1911 <[EMAIL PROTECTED]> wrote:
On 6/23/06, Dave Gray <[EMAIL PROTECTED]> wrote:
> On 6/23/06, Omega -1911 <[EMAIL PROTECTED]> wrote:
> > Shawn, I modified your example like so, was this correct?
> >
> > chomp( my $data1 = <IN> ); # line 1
> > chomp( my $data2 = <IN> ); # line 2
> > chomp( my $data3 = <IN> ); # line 3
> > chomp( my $data4 = <IN> ); # line 4
> > chomp( my $data5 = <IN> ); # line 5
> > while( <IN> ){
> >                chomp;
> >                push @past_bids, $_; # push remaining lines into array
> >                }
> >     close FILE;
>
> You still haven't told us WHY you want to keep the entire rest of the
> file you're reading in an array.
>

Actually, for this particular sub, I don't need the rest of the file and I
wasn't sure of the best method to extract the first five lines without
re-writing the file structure.

Your advice is welcomed and I would appreciate any clues or insight on an
efficient style of code.

Simply reading lines from a file does nothing to affect the file
itself, unless it happens to be a quantum file (ha ha), which it
isn't. You can omit the while loop and have exactly the same behavior
without wasting a lot of memory.

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