Irfan J Sayed <mailto:[EMAIL PROTECTED]> scribbled on Thursday, April
13, 2006 9:46 AM:

> Hi,
> 
> I am executing following command.
> 
> my @activity = system "cleartool lsactivity -short -view
> Admin_Irfan_Project_int"; 
> 
> but the output of this command is not storing in the array. array is
> empty. 

This is what people generally do if their perl program is not doing what
they want.

1. print output of @activity.... hmmm. its some number... why number..
Let me look me in the manual of system command for the possible values
it returns.

So I do perldoc -f system (or google if I wish).

[...]

The return value is the exit status of the program as
returned by the C<wait()> call. 

[...]

oh.. so this is not the function I want. 

If you read further, you will see 

[...]

This is I<NOT> what you want to use to capture
the output from a command, for that you should use merely backticks or
C<qx//>, as described in L<perlop/"`STRING`">.

[...]

Eurika, I found the answer. 

Use either qx// or ``. 

I do perldoc perlop read the section under qx// and `STRING`.

Change the line to 
@activity = `cleartool lsactivity -short -view Admin_Irfan_Project_int`;

Its now working. 
Enough work for today. Have a cup of coffee.

--Ankur

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


Reply via email to