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' $!" } }
In reply to Re: Compare and copy array values
by jwkrahn
in thread Compare and copy array values
by tgolf4fun
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |