Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Don't ask to ask, just ask
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Thank you muba for the suggestion. I've reformulated the problem to the simplest level. See if you can figure out what is wrong. Following is the sample code

sub A { ... foreach $key(@some array) # eg: array contains values like Sunday, Mon +day , Tuesday..etc { ... ... ... push(@{$key[0]}, #some values); #create dereferenced array push(@{$key[1]}, #some values); #eg: Monday has # @Monday = ([1,23,4,8,], + # [12,58,77,9]); .. .. # what do i do here ?? } sub B #to be called by the user after running the sub A for the first +time { .. print "Enter the day to be plot: "; $a = <>; #this value is to be matched to the array name i.e Monday to + be plotted, .. # once the corresponding array is found , we plot the values + }
I'm thinking of the following solns :

1. Save the references for each of these dereferenced arrays as a variable and save it as a separate array and make the array global (or return it to the parent function and make it global)
2. Save each of the dereferenced arrays as global variables and try to access using Sub B ( what i have been trying but no luck so far).

Please suggest.. ( I'm new to perl .. I'm sorry if the above points seem foolish)..
Update: I think the naming convention for the array variable seems to be causing the issue Coz when i try to return the references for each of the arrays , it gives me the same scalar value(reference ) for different elements.. I need a way out of this and quick .!! Please help

In reply to Re: Multidimensional arrays within arrays by reaper9187
in thread Multidimensional arrays within arrays by reaper9187

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others avoiding work at the Monastery: (7)
    As of 2014-04-17 05:28 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (439 votes), past polls