# Append a '/' to directories if needed $target_dir .= '/' unless ($target_dir =~ m{\/$}); $tmp_dir .= '/' unless ($tmp_dir =~ m{\/$});