If I understand correctly, the keys of the hash %seen will be the directory names, so what you need to compare is the filename to those hash keys. What you are doing now is compare the filename to the value of one hash key.
what you want is to check if the result of the pattern match is a directory that has been seen.
foreach $i(@update){ $i =~ /^(\d{4})/; # match and grab into $1 the first four digit +s if($seen{$1} == 1){ # test if the dir has been seen copy($i,$to_dir); } }
In reply to Re: Compare and copy array values
by olus
in thread Compare and copy array values
by tgolf4fun
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |