Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Re: a flash of inspiration...

by cLive ;-) (Prior)
on Apr 05, 2001 at 01:41 UTC ( #69904=note: print w/replies, xml ) Need Help??


in reply to Re: a flash of inspiration...
in thread Closing and re-opening the DATA Filehandle

Am I missing something here?

Is there any reason why you can't read in the data when the module is loaded, and assign it when you need to?!? ie:

package mod_name; { local $/; @mod_name::TableTemplate = map {chomp; hex} split ' ', <DATA>; close DATA; } my @Table = @mod_name::Table_Template;

Or am I missing something completely obvious ?!?

cLive ;-)

Replies are listed 'Best First'.
Re: Re: Re: a flash of inspiration...
by Adam (Vicar) on Apr 05, 2001 at 01:51 UTC
    wellllll.... (hem, haw)
    That would work. I could do that. But that doubles the memory requirements, requires an additional cost of copying the table the extra time. In most cases, you would be right. But in this case, what I need is to re-read the data section. That is the specific task on hand. You see, in the real world this routine would only get called once. But I want to Benchmark it. Thus the problem. Caching DATA like that would defeat the benchmark.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://69904]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2019-08-25 20:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?