Hi Fish,

In my example (there is no metachar), the two forms of system call are the same.
from perldoc -f system:

If there is only one scalar
argument, the argument is checked for shell metacharacters, and if there are 
any, the entire argument is passed
to the system's command shell for parsing (this is "/bin/sh -c" on Unix 
platforms, but varies on other
platforms). If there are no shell metacharacters in the argument, it is split 
into words and passed directly to
"execvp", which is more efficient.




> Message du 27/06/11 14:23
> De : "Shlomi Fish" 
> A : pa...@laposte.net
> Copie à : "Irfan Sayed" , "Perl Beginners" 
> Objet : Re: rmdir
>
> Hi Pangj,
> 
> On Mon, 27 Jun 2011 14:07:51 +0100
> pa...@laposte.net wrote:
> 
> > 
> > Won't system "rm -rf /path/to/dir" just work for you?
> > 
> 
> 1. This is on Windows, so "rm" may not be available. perldoc -f system in
> general is not portable.
> 
> 2. Better use the list form of system:
> 
> system("rm", "-fr", $path);
> 
> With the string version, you're risking code injection:
> 
> http://shlomif-tech.livejournal.com/35301.html
> 
> Regards,
> 
> Shlomi Fish
> 
> > 
> > 
> > > Message du 27/06/11 13:59
> > > De : "Irfan Sayed" 
> > > A : "Shlomi Fish" 
> > > Copie à : "Perl Beginners" 
> > > Objet : Re: rmdir
> > >
> > > i did that but no luck
> > > is there any another way ?
> > > 
> > > regards
> > > irfan
> > > 
> > > 
> > > 
> > > ________________________________
> > > From: Shlomi Fish 
> > > To: Irfan Sayed 
> > > Cc: Perl Beginners 
> > > Sent: Monday, June 27, 2011 5:05 PM
> > > Subject: Re: rmdir
> > > 
> > > 
> > > 
> > > 
> > > Shlomi Fish (shlo...@shlomifish.org) added themselves to your Guest List |
> > > Remove them | Block them 
> > 
> > Une messagerie gratuite, garantie à vie et des services en plus, ça vous
> > tente ? Je crée ma boîte mail www.laposte.net
> > 
> 
> 
> 
> -- 
> -----------------------------------------------------------------
> Shlomi Fish http://www.shlomifish.org/
> Why I Love Perl - http://shlom.in/joy-of-perl
> 
> Chuck Norris writes understandable Perl code.
> 
> Please reply to list if it's a mailing list post - http://shlom.in/reply .
> 

Une messagerie gratuite, garantie à vie et des services en plus, ça vous tente ?
Je crée ma boîte mail www.laposte.net

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to