Copying a file using the File::Copy
#!/usr/bin/perl -w use File::Copy; $input = "text.txt"; $output = "text1.txt"; copy($input, $output) or die "Can't copy $input to $output due to $!.";