Один из способов:
echo "else if(a,b,c,d,e)" | perl -pe 's/,([a-z])(?=[^)])/+x==$1 and $1/g; s/,([a-z])/+x==$1/'