in reply to Re: Retrieve "ps -ef" strings using regex
in thread Retrieve "ps -ef" strings using regex

Thank a lot wise Monks.
I finally figured it out before seeing your replies:

my $logname = `logname`; chomp($logname); my @output = `ps -ef | grep $logname`; foreach(@output) { chomp; next if /\~$/ || !$_; my $file = $_; if ($file =~ /^.*\/export\/home\/$logname\/(.*)\/bin\/.*?/) { print "$1\n"; } }


Displays what I want:
folder1
folder2
folder3

The soluce was indeed in the array instead of the string.