On 11/24/07, AndrewMcHorney <[EMAIL PROTECTED]> wrote:

>   I am looking for a perl function or functions that will give me the
> date and time.

Are you looking in the perlfunc manpage? Type 'perldoc perlfunc' at a
prompt (or into your favorite search engine) to get started.

> I am going to use the results to create a unique file name.

Even if you have the time to the second, there may be another process
active during the same second. One common and easy way to do what I
think you want is to include the process ID (PID) and some small
string (such as your program name), along with $^T as as the time.
Even though process IDs are eventually reused, the process ID is a
unique value while the program runs. If my program were named fred, I
might use something like this:

  my $unique_file_name = "fred.$^T.$$";

Perl's special variables, such as $$ and $^T, are documented in the
perlvar manpage.

Cheers!

--Tom Phoenix
Stonehenge Perl Training

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to