Hello, The output from the system command may be better stored in a scalar and then split into an array (separated by return line characters). Then you can use the 'foreach' operator for each element in your array.
@arr1 = qw/java oracle/; $scalar = `ps -eo pid,user,pcpu,pmem,args | grep -v grep | grep $arr1[1]`; @arr2 = split(/\n/, $scalar); $length = $#arr2; foreach my $val (@arr2) { # get rid of the leading space for each line if one exists $val =~ s/^\s//; @arr = split(/\s+/,$val); print $arr[1]."\n"; } ******************************************************************************* The views, opinions, and judgments expressed in this message are solely those of the author. The message contents have not been reviewed or approved by the UFT Welfare Fund. ******************************************************************************* -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/