in reply to Destructors and global variables

I guess I wasn't clear in my post. Now that I read it again I see my mistake. So let me give a more detailed explanation. What I am trying to do is to parse through an html file and create objects (am using the moose module for class creation).

if(...something...) { $n_DT[$count] = DT->new; if($line =~ m/>(.*)</) { $n_DT[$count]->{'ID'} = $1; } ... } elsif(..something else)...) { $r_DT[$count_1] = r_DT->new; if($line =~ m/>(.*)</) { $r_DT[$count_1]->{'ID'} = $1; ... }

The variables n_DT and r_DT are arrays of objects which I want to use/share between the two scripts. I am also saving the two arrays in text files. So I could possibly read the files again to create my list, but I was wondering if there was another, more efficient, way of doing this. Hope this clears my question.

Replies are listed 'Best First'.
Re^2: Destructors and global variables
by ikegami (Patriarch) on Jun 11, 2011 at 04:03 UTC

    The variables n_DT and r_DT are arrays of objects which I want to use/share between the two scripts.

    Again with variables in files.

    So I could possibly read the files again to create my list, but I was wondering if there was another, more efficient, way of doing this.

    You want to share between two processes, perhaps?

    Actually, sounds more like passing for one process to another rather than sharing.

    Unless the second process is a fork of the first, you have to somehow convert the array to a string of bytes to pass it from one process to another. You do have choices as to how to convert the array to bytes (Storable, JSON, etc) and how you actually pass it (file, pipe, socket, etc), but efficiency is not going to be the deciding factor.