I am a seeker of your knowledge and hope you can help me clear up my confusion.

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.

graphSocket: @response = "@response" . "," . "@threads" . "@restarts"; print "\@reponse: @response\n"; print $new_sock "@response\n";
I issue a print right after I append them to the @response array and since each is printed, I assume @response now contains them.

The following is how my client is attempting to receive them back:

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
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).

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


In reply to How do I create and pass an array of arrays to other modules by gerry

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.