I suggest you install sudo, it's designed for this kinds of tasks.
Abigail
In reply to Re: su to root in a perlscript by Abigail-II in thread su to root in a perlscript by NaSe77