[wplug] Perl System Funcion

Jonathan Billings billings at negate.org
Mon Sep 3 19:56:54 EDT 2007


Matthew T. Engel wrote:
> I using perl 5.8.8 on Gentoo 2.6.20.  I am continually having a problem 
> where the system() function does not interpret (or ignores) the second 
> scalar variable.

That's unlikely.  The string you are passing to system() is interpolated 
by the Perl parser before it is passed on to the shell.  Any problem you 
are having has nothing to do with the system() call but with the string 
interpolation.

> Something like System(“cd /home/$user/$web_root && ls), does an ls on 
> /home/$user rather than /home/$user/$web_root.  The system() function 
> returns 0, I get the same thing if I try system(cd /home/$user && cd 
> $web_root && ls).

Try replacing system() with print, and examine the results closely. 
Make sure the variables don't have any odd metacharacters that the shell 
might be interpreting.

-- 
Jonathan Billings <billings at negate.org>




More information about the wplug mailing list