"Anthony J Segelhorst" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am working on script to kill a process if it have been running for 45
> minutes or more.
>
> I am using a pstool called pslist to gather the data on the process.  This
> out put looks like:
>
> C:\Tivoli\lcf\bin\w32-ix86\tools>pslist EXCEL
>
> PsList 1.23 - Process Information Lister
> Copyright (C) 1999-2002 Mark Russinovich
> Sysinternals - www.sysinternals.com
>
> Process information for CRP-DAY1-M73183:
>
> Name          Pid Pri Thd  Hnd    Mem    User Time   Kernel Time   Elapsed
> Time
> EXCEL        4060   8   4  182  15640  0:00:00.190   0:00:00.220
> 0:11:22.721
>
> C:\Tivoli\lcf\bin\w32-ix86\tools>
>
>
> I started to build my array by doing:
>
> @temparry = `"$lcf_tools\\pslist EXCEL"`;
> foreach $temp (@temparray){
>  ($name,$pid,$pri,$thd,$hnd,$Mem,$usertime,$kerneltime,$elapsedtime) =
> split(" ",$temp);
>
> This is all wrong though, how I skip down to the line beginning with EXCEL
> to start build my array.

I'm surprised this works at all with double quotes inside your backticks.
Here's how I'd write it.

HTH,

Rob



  use strict;    # always
  use warnings;  # usually

  my $lcf_tools;

  my @array = grep /^EXCEL/, `$lcf_tools\\pslist EXCEL`;
  chomp @array;

  foreach (@temparray) {
    my ($name,$pid,$pri,$thd,$hnd,$Mem,$usertime,$kerneltime,$elapsedtime) = split;
  }




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

Reply via email to