Your code is completely hopeless, even as pseudo code so I'm pretty much ignoring it completely. I suspect you are very new to Perl and maybe haven't actually written very much working code. As a hint for the future: always use strictures (use strict; use warnings;).

However your first paragraph and node title resonate with each other and strongly suggest you want a Perl hash in the mix somewhere. It's a little more complicated than just a hash though because you have a list of files to process and lists of things are stored in an array. So the data structure you probably need is and array of hashes. Consider:

use warnings; use strict; # Source Location, Filename, An ID that I need for file processi +ng my @files = ( {path => 'C:\Source1\\', name => 'File1.txt', id => 'Referenc +e1'}, {path => 'D:\Source2\sub\\', name => 'File2.txt', id => 'Referenc +e2'}, {path => 'E:\Source3\sub2\\', name => 'File3.xml', id => 'Referenc +e3'}, {path => 'C:\Source4\\', name => 'File4.pgp', id => 'Referenc +e4'}, ); my $to = "Z:\\Processing\\"; for my $file (@files) { print "Move '$file->{path}$file->{name}' to '$to$file->{name}' ref + $file->{id}'\n"; }

prints:

Move 'C:\Source1\File1.txt' to 'Z:\Processing\File1.txt' ref Reference +1' Move 'D:\Source2\sub\File2.txt' to 'Z:\Processing\File2.txt' ref Refer +ence2' Move 'E:\Source3\sub2\File3.xml' to 'Z:\Processing\File3.xml' ref Refe +rence3' Move 'C:\Source4\File4.pgp' to 'Z:\Processing\File4.pgp' ref Reference +4'
True laziness is hard work

In reply to Re: Howto build an (associative?) array to process files in different locations by GrandFather
in thread 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.