Thank you for this explanation. Being new to Perl, it is very helpful.
I have several commands that I would like to execute as other_user , so I would like that particular shell to execute more than one command. As in the sample code, I would like to su to the user and print "cOmMaNd LiNe" without any external interaction. Needing to type "exit" from the command line (in order to get "cOmMaNd LiNe" to print) prohibits this ability.
I think your explanation and the example given by cdarke both look promising.