one liner, as requested (:
(it should add one line to the file in case it's not already there and that's all, right?!)
perl -pi -e '$line = 1 if /pattern/; print "the line\n" if !$line&&eof' /etc/ld.so.conf
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
women.pm