I've got a bunch of files I need to pull from various locations and process them individually. I'd like to store the information on their location and filename along with an ID to process them by in an array, and split on a delimiter like say a comma.

This is all basicly sudo code I'm writing as i think about it, I know that I don't know what i need but I'm hopfully close enough to explain my need :D

Here's a rough example.
# Source Location, Filename, An ID that I need for file processi +ng @array('C:\Source1\', 'File1.txt', 'ReferenceIDForProcessing' 'D:\Source2\sub\', 'File2.txt', 'ReferenceIDForProcessing' 'E:\Source3\sub2\', 'File3.xml', 'ReferenceIDForProcessing' 'C:\Source4\', 'File4.pgp', 'ReferenceIDForProcessing'); # Assuming the syntax is even close, how do I then irrerate over that +array to process each line or grouping? # I'm hoping to do a loop something like this $centralLocation = "Z:\Processing\"; open(FILES, "<@array") or die $!) ; while (<FILES>) { $line = $_ ; chomp($line) ; @FILE = split(/,/, $line) ; # Split each line into the 3 differ +ent parts. (Example in first line of the array) Move (@FILE[0]@FILE[1],$centralLocation); # Now all files would be + in a central location for processing (ie: Move C:\Source1\File1.txt +to Z:\Processing) Process ($centralLocation@FILE[1], @FILE[2]); # How the sending wo +rks is irrevlant, only that I can put the @info[2] there for each fil +e to process. } close(FILES);
Please let me know if you have trouble following what I'm after, I'm sure what i need is relatively simple, I just don't do much in the way of arrays

In reply to Howto build an (associative?) array to process files in different locations by shadowfox

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.