Hello everyone. I am writing a Perl script that will be installed on a Linux host. I need the script to be able to access the current time / date environment variable somtimes. I've looked through a list of the standard CGI variables that can be accessed through $ENV but time / date isn't one of them. Is it possible to pass commands to the host's shell from within a Perl script and have the result piped back into the script? If so I could just pass:

date

Or maybe there is a simpler way to do this that I'm missing. Any advice would be appriciated.

Steven.

Recommended Answers

All 3 Replies

Thanks Kevin. I'm sure one of those methods will do the job.

Steven.

you may use also:

print scalar localtime();

Svet

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.