howto list running processes with Perl?
am 19.04.2005 18:17:52 von clintplease help.
i need to list running processes with Perl, any suggestions?
many thanx
clint
please help.
i need to list running processes with Perl, any suggestions?
many thanx
clint
On Tue, 19 Apr 2005 16:17:52 +0000, clint wrote:
> please help.
> i need to list running processes with Perl, any suggestions?
> many thanx
> clint
sorry i mean howto count them!
thanx
clint
clint wrote:
> On Tue, 19 Apr 2005 16:17:52 +0000, clint wrote:
>
>> please help.
>> i need to list running processes with Perl, any suggestions?
>> many thanx
>> clint
>
> sorry i mean howto count them!
> thanx
> clint
A rude approach would be to use backticks:
my @proc = `ps -ax`;
my $cnt = $#proc;
print "Running processes: $cnt\n";
But while where already spawning a process, why not spawn 2 and save a line
of code:
my $cnt = `ps -ax | wc -l` + 0;
print "Running processes: $cnt\n";
LLAP & LG
Rene
For windows you can use the Win32_Process of wmi , or for faster execution
use the Win::API module to call the psapi.dll
Rene Schickbauer wrote:
> clint wrote:
>
>
>>On Tue, 19 Apr 2005 16:17:52 +0000, clint wrote:
>>
>>
>>>please help.
>>>i need to list running processes with Perl, any suggestions?
>>>many thanx
>>>clint
>>
>>sorry i mean howto count them!
>>thanx
>>clint
>
>
> A rude approach would be to use backticks:
>
> my @proc = `ps -ax`;
> my $cnt = $#proc;
> print "Running processes: $cnt\n";
>
> But while where already spawning a process, why not spawn 2 and save a line
> of code:
>
> my $cnt = `ps -ax | wc -l` + 0;
> print "Running processes: $cnt\n";
>
> LLAP & LG
> Rene
why not just
print `ps -ef | wc -l`;
Eric
clint
> please help.
> i need to list running processes with Perl, any suggestions?
> many thanx
> clint
On what platform - windows, mac, linux?
Tim
--
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you
really need to send mail, you should be able to work it out!