open($syscmd,"ps -a |") || die "unable to open system command $!\n"; $count =0; while (<$syscmd>){ @list1 = split(" ", $_); @list[$count] = @list1[3]; $count = $count + 1; } $set = 0; foreach $val(sort keys(%prolist)){ #checks through every element +in the hash one by one. while(<@list>){ #looks through each element in list for a matc +h if ($prolist{$val} eq $_ ){ #if the match is found $set = 1; #sets this to true so that the below if sta +tment isn't executed last; } } if ($set == 0){ #prints only if there is no match print + "NF: $prolist{$val}\n"; } $set = 0; #resets boolen }
In reply to Re: Re: loop control
by maxl90
in thread loop control
by maxl90
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |