Hi,

system will execute the command, and return only the exit status back.
Therefore u cannot trap the output into a variable.

If u want the output of a command into a variable, u can use backticks.

Example :

($output) = `date +%Y%m%d-%H%M%S`;
chomp $output;

This way, the output of the date command will be put into $output.

U then have to chomp it to remove the newline.

Hope it helps.

Ciao.
George P.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
George Pereira
CMIE
11, Apple Heritage,
54-C, Andheri-Kurla Rd.,
Andheri (E), Bombay 400093
Tel: 8219595
Fax: 8219696
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

On Mon, 10 Sep 2001, Alexander Bjelke wrote:

> I want to get the output from the following command into an variable:
>
> system("date +%Y%m%d-%H%M%S");
>
> I have tried:
> $output = system("date +%Y%m%d-%H%M%S");
> But that does not work (only get 0 in that variable).
>
> Please help!
>
> Alexander
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to