There are three problems with your code :
First, system() returns 0 on success and non-zero on failure, so the method to use it is :
system "..." and die "Error: $! / $?";
The cd thing you enter on the command line is no external command but a built-in command of cmd.exe. Thus you would have to do system($ENV{COMSPEC},'/c cd c:\temp').
Using shell commands to set the current directory is not guaranteed to influence the current working directory of the parent. You want to use the CwdFile::chdir module to change the directory and the unlink() function to erase files.
perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
In reply to Re: Problem with system ()
by Corion
in thread Problem with system ()
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |