in reply to Re^2: file is not getting copied
in thread file is not getting copied

That's not what your source code says:

my $copy_from = "C:/Users/Admin/Desktop/Staples files/readfile.txt";

This means that your source file is in C:/Users/Admin/Desktop/Staples files. I would assume that Perl is correct when it says that it cannot find the file.

Replies are listed 'Best First'.
Re^4: file is not getting copied
by manishrathi (Beadle) on Jul 17, 2011 at 18:13 UTC
    my $copy_from = "C:/Users/Admin/Desktop/Staples files/readfile.txt";
    This is the source

    Output message is
    C:\Users\Admin>perl C:\Users\Admin\Desktop\perl_programs\copyfn.pl Can't copy because: No such file or directory at C:\Users\Admin\Desktop\perl_programs\copyfn.pl line 7

    So why is Perl looking for readfile.txt in this location ? Obviously, readfile.txt is not located in perl_programs. When source path is provided, Perl should look into that source path.
    Please explain
      ... at C:\Users\Admin\Desktop\perl_programs\copyfn.pl line 7

      means that the error was found when Perl ran the line number 7 in the named program. This has nothing to do with $copy_from or $copy_to, but it helps you to know what command failed.

        So my confusion is how to resolve this problem ? I am giving source and destination properly and files do exist in specified location. I am using copy function properly. SO why is it not working ?

        Thanks