$ps = `/usr/bin/ps –ef`; #get all processes, store in $ps @all = split /\n/, $ps; #split by newlines, put into @all array foreach $proc (@all) { #loop once for each item in @all array #process data here }