in reply to Where does the 6th process come from? [SOLVED]

The grep.

- my $procs = qx(ps aux | grep [p]erl | wc -l); + my $procs = qx(ps aux | grep [p]erl | grep -v grep | wc -l);

update: Scratch that. The [p] avoids the grep to be included.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Replies are listed 'Best First'.
Re^2: Where does the 6th process come from?
by Anonymous Monk on Apr 22, 2017 at 15:27 UTC
    The [p] should obviate the need for grep -v, but maybe you should use quotes around the pattern: grep '[p]erl', or better yet,
    my $procs = grep /perl/, qx(ps aux);