=head1 NAME B - Make a backup copy of a file =head1 SYNOPSIS bak file ... =head1 DESCRIPTION A uniquely-named backup copy of a file is created. The file is written to a subdirectory named C, which will be created if it does not yet exist. The name of the backup copy is the original filename with a date and timestamp appended to it. Multiple files may also be specified. Output: A file to subdirectory named C. Example1: bak file.txt Example2: bak *.doc =cut use warnings FATAL => 'all'; use strict; use File::Copy; use POSIX qw(strftime); die "Error: No files specified\n" unless @ARGV; mkdir 'backup'; my $date = strftime('%y%m%d_%H%M%S', localtime); for my $file (@ARGV) { copy($file, "backup/${file}_$date") or die "Copy failed: $!"; }