Hi Pangj, On Mon, 27 Jun 2011 14:31:19 +0100 pa...@laposte.net wrote:
> Hi Fish, Since “Fish” is my last name, it should be "Hi Mr. Fish,", or perhaps "Hi Shlomi". See: http://www.joelonsoftware.com/articles/ResumeRead.html <<<< In most of the English speaking world it is not considered polite to open letters to a Mr. Joel Spolsky by writing "Dear Spolsky." One might write "Dear Mr. Spolsky," or "Dear sir," or perhaps, "Hi Joel!" But "Dear Spolsky" is usually followed by some story about embezzled funds and needing to borrow my bank account. >>>> > > 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. > You are right in this simple case. However, let's say you're doing: system("rm -fr $path"); Where $path is input from the user? This may contain shell metachars and they may do a world of damage. So it's better to use: system('rm', '-fr', $path); Regards, Shlomi Fish > > > > > 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 -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Funny Anti-Terrorism Story - http://shlom.in/enemy There was one Napoleon, one George Washington, and one me! — Big Boy Caprice in http://en.wikiquote.org/wiki/Dick_Tracy_%281990_film%29 Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/