in reply to su to root in a perlscript
I suggest you install sudo, it's designed for this kinds of tasks.
Abigail