Front page | perl.beginners |
Postings from December 2002
Re: file into memory
Thread Previous
|
Thread Next
From:
Rob Dixon
Date:
December 24, 2002 03:43
Subject:
Re: file into memory
Message ID:
20021224114345.81206.qmail@onion.perl.org
OK, what you've written looks exactly right, which means your problem is
somewhere else. We need to see more of your code, and to know why you think
it's not working. (Don't forget to close the file after reading it!!)
Just one thought: you need to be aware that each of your array elements has
the record separator character ( usually '\n' ) at the end.
Cheers,
Rob
"Schwedler Kofoed" <Schw_kof@mail.tele.dk> wrote in message
news:NGBBLKKMBFHHPOGPBOOEMEHNCHAA.Schw_kof@mail.tele.dk...
> Hi all,
>
> I would like to open a file with the content:
>
> peter 141444
> oscar e324345
> simon j85547
>
> in a perl script - but instead of reading the file one line at a time I
> would like to suck the whole file into memory and processing each line
from
> there.
>
> I have tried to:
>
> open FILE, "< tmp.txt";
> @xx = <FILE>;
> while $file(@xx) {
> ................
> }
>
> but I cant get it to work - where did I go wrong ?
>
> Thanks!
>
> /Jakob
>
Thread Previous
|
Thread Next