in reply to Compare and copy array values
It sounds like you need something like this:
my %file_lookup; for my $file ( @update ) { push @{ $file_lookup{ substr( $file, 0, 4 ) } }, $file; } for my $dir ( @prod ) { next unless exists $file_lookup{ $dir }; for my $file ( @{ $file_lookup{ $dir } } ) { copy( $file, "$dir/$file" ) or warn "Cannot copy '$file' to '$ +dir/$file' $!" } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Compare and copy array values
by tgolf4fun (Novice) on Mar 19, 2008 at 20:54 UTC | |
by wardy3 (Scribe) on Mar 19, 2008 at 22:21 UTC | |
by Narveson (Chaplain) on Mar 19, 2008 at 21:17 UTC | |
by tgolf4fun (Novice) on Mar 19, 2008 at 23:24 UTC |