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!

In reply to Re:(fireartist) Writing Files To Directorys by fireartist
in thread Writing Files To Directorys by ap3k

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.