open(my $fh,"<","/pathtologfile/logfile.log") or die "can not open the file $!"; my @lines = <$fh>; close($fh); my $count=0; for(my $i=0; $i<=$#lines;$i++) { my @pids = (`ps -ef | grep acuser | grep 2015/01/15 | grep sync_cmd | awk '{print $2}'`) ; }