in reply to Re^2: File name is long to copy
in thread File name is long to copy

Which version of Windows? It doesn't look like you tried what I suggested, note the $!

copy( $source, $target ) or die "couldn't copy file $!"; #---------------------------------------------------^

Replies are listed 'Best First'.
Re^4: File name is long to copy
by harishnv (Sexton) on Apr 26, 2020 at 13:36 UTC

    The error is "couldn't copy file No such file or directory at C:\sandboxes\Scripts\dummy.pl line 9."

      I suggest changing the error message like hippo advised here
      "couldn't copy file '$source' to '$target': $!";
      and perhaps count the backslashes.

      If you are convinced the path/filename is correct, can you replace the copy with syscopy to make use of Win32::CopyFile via Win32API? Which version of Perl are you running?

        Perl512 I used syscopy, got this error "Undefined subroutine &main::syscopy called at .."

Re^4: File name is long to copy
by harishnv (Sexton) on Apr 26, 2020 at 13:38 UTC

    Windows 10 and the file is present because there are other files which I copy in that directory