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'
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |