Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: How to pass arrays into this program?

by BrowserUk (Pope)
on Dec 12, 2013 at 13:16 UTC ( #1066839=note: print w/ replies, xml ) Need Help??


in reply to How to pass arrays into this program?

I have 3 arrays, namely @array_names, @array_numbers1 and @array_numbers2, how do I pass their values into the array @data?

Where do you have these 3 arrays? Ie. In another script? In shell variables?


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re: How to pass arrays into this program?
Replies are listed 'Best First'.
Re^2: How to pass arrays into this program?
by Anonymous Monk on Dec 12, 2013 at 13:25 UTC
    Yeah, sorry!
    I meant, I want to read a tab-separated file and store the data that are now hard-coded into arrays... So, open the tab-separated file, create the 3 arrays and then pass them into @data, instead of writing their values by hand, like I do now...

      It sounds like Text::CSV will do what you want.

      Please note that the majority of the code you posted has nothing to do with your question: this just leads to confusion (and perhaps frustration) when attempting to isolate the handful of relevant lines from the two screenfuls of code you posted. A better question will get better answers: the guidelines in "How do I post a question effectively?" can help you achieve this.

      -- Ken

      ... my @array_names = readfile( "somename" ); my @array_numbers1 = readfile( "someothername" ); my @array_numbers2 = readfile( "anothername" ); my @data = ( \@array_names, \@array_numbers1, \@array_numbers2 ); ...

      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        Aha, I see!
        Thank you very much!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2015-07-28 03:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (252 votes), past polls