CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [koti688] Memory issue while opening and reading a file: Edit Log



FishMonger
Veteran / Moderator

Apr 3, 2009, 6:47 AM


Views: 3820
Re: [koti688] Memory issue while opening and reading a file


In Reply To
can i dod this way



Code
 
my (@keys, @values);
open(TEST,"<$sigDataFile") || die("This file will not open!");
while(<TEST>) {
my ($key,$value)=split /=/;
push @keys,$key;
push @values,$value;
}
close(TEST);

print @keys;
print @values;


That sill puts your entire file into memory, but now you're using 2 arrays instead of 3. The only advantage is that you're not duplicating the data.

What do you need to do with the data?


(This post was edited by FishMonger on Apr 3, 2009, 6:48 AM)


Edit Log:
Post edited by FishMonger (Veteran) on Apr 3, 2009, 6:48 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives