Without knowing what user you are logging in as (and therefore what user your files are running as), and more about your directory setup, I'll just describe how I do this.
My home directory is
/home/username/www.domain.com
I ftp / telnet into the box using the same username, so I know the files will be owned by the same user that owns the directories.
My home directory has 2 sub-dirs named
public_html and
cgi-bin. So I create another sub-dir named
data and change the permissions to
777 or
drwxrwxrwx (check this with
ls -l) - or 755 if the files are owned by the same user the web-server is running as.
The full path to this directory is
/home/username/www.domian.com/data
If your script is getting user input, then it should be running under
taint mode.
#!/usr/bin/perl -wT
And the warnings switch will also help figure out what's going wrong.
Regarding creating a filename using the date/time, a
search of perlmonks for "
filename date time" gives the following results (among others).
Filenames based on timestamp
create file with current date for name
Renaming file with date
Date in filename
update:
corrected required file permissions from 666 to 777 and clarified, thanks to
grinder!