use File::Copy (); sub copy_recursive {   my ($src, $dst) = map { noslashatend( dos2unix($_) ) } @_;   die "Not a directory" unless -d $src;   mkdir $dst;     if(opendir(my $dir, $src)) {      while(my $file = readdir $dir) {         next if $file =~ m!^\.\.?$!;                 my $srcpath = "$src/$file";         my $dstpath = "$dst/$file";         if(-d $srcpath) {            copy_recursive( $srcpath, $dstpath );         } else {            File::Copy::copy( $srcpath, $dstpath );         }      }      closedir $dir;   } } sub noslashatend {   my $path = shift || '';   $path =~ s!/+$!;   return $path; } sub dos2unix {  my $path = shift || '';  $path =~ s!\\!/!g;  return $path; }