perl -pi -e 's/^(\s+)?(telnet|shell|login|exec)/# $2/' /etc/inetd.conf
will remove any leading whitespace before "telnet" or "shell" or ...
whereas
perl -pi -e 's/^(\s)*(telnet|shell|login|exec)/# $2/' /etc/inetd.conf
Would presumably replace the line with the second whitespace charecter, if there was one...