perl datefunction

Hi All,
I am finding it difficult to use the date funtion inside another perl program.

system('perl -e 'print time(localtime() - 86400) . "\n" ' ' )

The above gives yesterday's date when running from the command prompt.

When I call it inside another perl script the it is showing the syntax error.
Backslash found where operator expected at megh.pl line 5, near ""perl -e 'print time(localtime() - 86400) . "\"
(Missing operator before \?)
String found where operator expected at megh.pl line 5, near "n" ' > datefile""
syntax error at megh.pl line 5, near ""perl -e 'print time(localtime() - 86400) . "\"

system(
Backslash found where operator expected at megh.pl line 5, near ""perl -e 'print time(localtime() - 86400) . "\"
(Missing operator before \?)
String found where operator expected at megh.pl line 5, near "n" ' > datefile""
syntax error at megh.pl line 5, near ""perl -e 'print time(localtime() - 86400) . "\"

Regards
Megh

I'm not sure what you would like to achieve with this. It doesn't make much sense to me. Did you swap the positions of time() and localtime()?

By the way, why running a Perl script inside another Perl script with system()?

system(q*perl -e 'print scalar localtime(time-86400)'*);