Move files to new directory

To move files to a new directory in Perl, you can use the rename function. Here's an example code snippet:

use File::Copy;

my $source_file = "path/to/source/file.txt";
my $destination_file = "path/to/destination/file.txt";

# Move the file
rename($source_file, $destination_file) or die "Unable to move file: $!";

In the code above, you need to specify the paths of the source file and the destination file. The rename function is used to move the file from the source path to the destination path. If the file is successfully moved, the function returns true. Otherwise, it returns false and the die function is called to display an error message.

Please note that you need to have the File::Copy module installed to use the rename function. You can install it using the following command:

cpan File::Copy

I hope this helps! Let me know if you have any further questions.