|
Posted by chung.ley@amd.com on March 30, 2005, 7:39 pm
Please log in for more thread options
Hi,
Another newbie question...
I have to write a program that process a huge amount of data; the end
results will be a number of different reports. I will prefer to write
a separate library/perl script for each of the reports to
separate/isolate them into their own files... However, how do I "pass"
this huge data to the "report_function" that is in their own file
without too much overhead... From what I understand, if I tried to
pass the "hash" as a parameter to the function, the function will
create a "copy" of it, which would be a significant overhead in terms
of memory and time since I am using multiple-level hash tables with
data in the Megs.... It seems that my only option is using "global",
but from what I read and also my personal experience, it seems that we
should avoid global variable as much as we can.... Can anyone give me
other options or alternatives?
Thanks....
--Chung
|
|
Posted by Sherm Pendley on March 30, 2005, 10:58 pm
Please log in for more thread options
chung.ley@amd.com wrote:
> From what I understand, if I tried to
> pass the "hash" as a parameter to the function, the function will
> create a "copy" of it
Pass a reference to the hash. For details, have a look at:
perldoc perlreftut
perldoc perldsc
perldoc perllol
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net Hire me! My resume: http://www.dot-app.org
|
|
Posted by Brian McCauley on March 31, 2005, 5:49 pm
Please log in for more thread options
chung.ley@amd.com wrote:
> Newsgroup: comp.lang.perl,comp.lang.perl.modules
The newsgroup comp.lang.perl ceased to exist some time in the previous
millenium. I suggest you break into your NNTP server admin's office and
remove the skeleton.
> From what I understand, if I tried to
> pass the "hash" as a parameter to the function, the function will
> create a "copy" of it,
If you unroll it into a list yes, but see FAQ "How can I pass/return a
.... Hash...?"
Those who will not learn from the FAQ are comdemned to repeat it.
> which would be a significant overhead in terms
> of memory and time since I am using multiple-level hash tables with
> data in the Megs....
But the copy would only be a shallow copy anyhow.
|
|
Posted by chung.ley@amd.com on March 31, 2005, 12:19 pm
Please log in for more thread options
Thanks for the response... Sorry, I didn't read the FAQ close
enough... I somehow missed that...
By the way, do you have a recommendation for a good newsgroup for
begineers?
I will read up on what is a shallow copy...
Thanks again.
|
|
Posted by Jim Keenan on March 31, 2005, 2:23 pm
Please log in for more thread options
chung.ley@amd.com wrote:
> By the way, do you have a recommendation for a good newsgroup for
> begineers?
>
http://www.nntp.perl.org/group/perl.beginners (though you'll probably
want to read it in a newsreader rather than the web interface)
and my old favorite:
http://groups.yahoo.com/group/perl-beginner/
HTH
jimk
|
| Similar Threads | Posted | | Passing Environment and ExtUtils::MakeMaker options to CPAN methods | August 5, 2005, 8:42 am |
| Modules for hash functions? (ie, common algorithms for computing hash keys, not manipulating perl hashes) | August 26, 2006, 7:08 pm |
| NetPacket::TCP and "options" field | February 15, 2005, 1:18 pm |
| pod2usage output options | April 11, 2008, 8:48 am |
| Re: pod2usage output options (correction) | April 11, 2008, 9:03 am |
| Passing a DBI connection between [Unix] processes | January 7, 2005, 1:01 pm |
| mod_perl2 passing env vars when doing internal_redirects | July 11, 2005, 8:24 am |
| Passing username and password using LWP::UserAgent | December 11, 2006, 4:40 am |
| Hash | July 14, 2006, 5:27 pm |
| "Undefined subroutine" | November 21, 2004, 8:48 pm |
|