foreach my $f (sort keys %{$rr}) { ++$m; $tp = ${$rr}{$f}{type}; # skip if the file only exists in to_dir next if ($tp =~ /^OLD/); $f1 = "${$rr}{$f}{f_pdir}/$f"; $f1 = "${$rr}{$f}{t_pdir}/$f"; ########## Jimbojones comment -- note that $f2 is never set. ####### if ($act =~ /^c/i) { # copy ++$n; copy $f1, $f2 if $tp =~ /^(NEW|EX1|EX2)/; } elsif ($act =~ /^m/i) { # move ++$n; copy $f1, $f2 if $tp =~ /^(NEW|EX1|EX2)/; move $f1; } elsif ($act =~ /^u/i) { # update ++$n; copy $f1, $f2 if $tp =~ /^(EX1|EX2)/; } elsif ($act =~ /^o/i) { # overwirte ++$n; copy $f1, $f2 if $tp =~ /^(EX0|EX1|EX2)/; } else { carp "WARN: $f - do not know what to do.\n"; } }