in reply to passing array arguments to exec()

You're explicitly telling exec that you want to bypass any parsing by the shell, but then trying to pipe the output of the command into another ... which is something that is usually handled by the shell, so you end up passing the pipe and the grep as arguments to ps which has no idea what to do with a |.

Instead, you want to pass exec a single string like...

  exec("ps -ef | grep $process");

... so the shell handles the piping, or perform the grep yourself within perl using the like-named grep on the captured output.

Also, you might want to look at the Shell module, which'd let you turn your code into (IMHO) the more legible ...

#!/usr/bin/perl -w use strict; use Shell 'ps'; my $process = "perl"; my @output = grep /$process/ => ps("-ef");

    --k.