in reply to Re: How do I get different files into an array
in thread How do I get different files into an array

Hello ww, You are correct my question was meant to ask how do I get the contents of a file ( and actually different files that list server names) pushed to an array.

  • Comment on Re^2: how do I get the contents of different files pushed to an array?

Replies are listed 'Best First'.
Re^3: how do I get the contents of different files pushed to an array?
by james28909 (Deacon) on Apr 14, 2015 at 20:30 UTC
    ww's solution is actually better than mine, the best way for you to do multiple files is to figure out a solution as to how you can create a list of files you need, wether it be all files in a dir or a pre-specified list. It sounds to me that your best bet is going to be to step back for a minute and think about how you can get a file list first. then parse each file with a for loop. Good Luck :)
Re^3: how do I get the contents of different files pushed to an array?
by ww (Archbishop) on Apr 14, 2015 at 21:01 UTC

    Follow this recipe (précis, quasi-pseudo-code):

    use strict; use warnings; open the first of the files w/server names; read contents to a $var; push $var to a new array (namely @all_server_names) rinse, repeat untill all files have been read and their content pushed Convert the above to code; execute