in reply to copy contents appending date

It looks like the shell is executing your program instead of perl.    You should begin your Perl program with these three lines:

#!/usr/bin/perl use warnings; use strict;