gerry has asked for the wisdom of the Perl Monks concerning the following question:
I have a graphClient that calls a graphServer via a TCP/IP socket. The graphServer accesses logfiles from previous online activities. From these logfiles, data is extracted to create three (3) arrays. Each array contains 1440 (0-1339) entries, (one for each minute of the day). Each entry contains the sum of the activity for that minute. The arrays are named based on the associated activity, (i.e. @queries, @threads, @restarts). The arrays are being created as I can print them out.
I pass these arrays back to the graphClient so the contents may be acted upon.
I issue a print right after I append them to the @response array and since each is printed, I assume @response now contains them.graphSocket: @response = "@response" . "," . "@threads" . "@restarts"; print "\@reponse: @response\n"; print $new_sock "@response\n";
The following is how my client is attempting to receive them back:
In graphClient, the socket routine (mevs_get_stats) is called which calls the server and receives the $response. I print the $response and all is okay, (the commas also print which show the separation of the arrays).graphClient: ...graphing routine mevs_get_stats($server, $mb_portno); # get the data from MEV +S Servers print "\nResponse returned from $server:\n$response\n"; # pri +nt response - THIS WORKS! @arrays = split(",", $response); # split queries/threads/rest +arts into @arrays -- DOESN'T WORK? print "\narray[0]: $arrays[0]\n"; # Prints Nothing?? print "\narray[1]: $arrays[1]\n"; # Prints Nothing?? print "\narray[2]: $arrays[2]\n"; # Prints Nothing?? # my @queries = split(" ", $arrays[0]); # split queries my @threads = split(" ", $arrays[1]); # split threads my @restarts = split(" ", $arrays[2]); # split restarts $i = 0; # init $i to 0 prior t +o indexing the matrix print "\nQueries(split response):\n@queries\n"; #debu +g print "\nThreads(split response):\n@threads\n"; #debu +g print "\nRestarts(split response):\n@restarts\n"; #debu +g
However, once I do my splits and presumably extract the data into separate arrays, I then print each array variables, $array0-2, and get absolutely nothing... At this point, it seems I know longer have any data/arrays.
I know I must be doing something wrong, I'm not sure what it is. I am hoping you can help get me on the right track.
Thanks to everyone for your help.
pcnut
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do I create and pass an array of arrays to other modules
by xdg (Monsignor) on Aug 19, 2005 at 18:47 UTC | |
by gerry (Sexton) on Aug 19, 2005 at 20:59 UTC | |
|
Re: How do I create and pass an array of arrays to other modules
by poj (Abbot) on Aug 20, 2005 at 08:39 UTC |