thanks very much, ya i noticed that couldn't figure out what was going on.

havent used perl in a  long while... should probably start doing that more.

Andrew J. Kopciuch wrote:
[EMAIL PROTECTED]">
On Thursday 29 August 2002 01:31, Nathan Wainwright wrote:
hey,
anyone have a idea how i can pass the value of 'system("date");' into
$date ?

$date = system("date"); keeps returning '0'

im stumped.

thanks.


If you are just looking to capture the date string in a var, try using the
built in perl functions like:

$date = gmtime();
$date = localtime();

Using perl is also like a combination of shell scripting. If you absolutely
need the string value of the command line "date" program

$date = `date`; # (note the backticks)


The system() function does not do what you are thinking. It is exactly like
exec in shell scripts except it forks first, and then waits for completion of
the task. The return value is not the output of the command.

Basically what you did was tell the interpreter to execute the command 'date'
as if on the command line, and assign that programs return value (which is 0)
to the var $date.

Did you notice that the date output was printed to the screen when you ran the
script?






http://www.perldoc.com

might be useful, check it out.







Reply via email to