#!/usr/local/bin/perl system("ps -ef | grep Jones > outr"); $outr = 'outr'; open(OF, "$outr") || die "Can not open $outr: $!\n"; @data=(); close(OF); open(OF,">$outr") || die "File not opening $outr: $!\n"; foreach $_ (@data) { next if ($_ !~ m/\/usr/local/bin/perl ps1$/) && ($_ !~ /sh \-c ps \-ef \| grep jones \> out) ; print OF $_; } close(OF);