Code Comments
Programming Forum and web based access to our favorite programming groups.please help. i need to list running processes with Perl, any suggestions? many thanx clint
Post Follow-up to this messageOn 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
Post Follow-up to this messageclint wrote: > On Tue, 19 Apr 2005 16:17:52 +0000, clint wrote: > > > 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
Post Follow-up to this messageFor windows you can use the Win32_Process of wmi , or for faster execution use the Win::API module to call the psapi.dll
Post Follow-up to this messageRene Schickbauer wrote: > clint wrote: > > > > > 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 lin e > 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
Post Follow-up to this messageclint <clint@freemail.hu> writes: > 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!
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.