# ... up to this point, # you must have read 1 line from the file ... # and (for sake of example) the email field saved in into $email_field variable. my @emails; while ($email_field =~ m/SMTP:([^\%]+)\%/g) { # validate matched email first... (as per UPDATE) push @emails, $1; # add email address to the list } # @emails array now contains all SMTP email addresses # found in the field. #### $"=q;grep;;$,=q"grep";for(`find . -name ".saves*~"`){s;$/;;;/(.*-(\d+)-.*)$/;$_=["ps -e -o pid | "," $2 | "," -v "," "]`@$_`?{print"+ $1"}:{print"- $1"}&&`rm $1`;print"\n";}