in reply to Passing user input to a shell command
You should not be using qw in the system call. Take it out.
Try this, to see why:
print "$_\n" for qw "perl /Users/james/perlstuff/macc/macc1 $file";
You might have other problems with that program as well.
For starters, you should probably chomp($file) immediately after reading it in.
Also, you're opening the file for reading, then immediately passing the filename
to an external program. I really don't think you want to do both. You certainly
don't need to open a file before passing it to an external program; that
program will do what it wants with the name, and wouldn't see your open filehandle
anyway.
Thirdly, you're pulling in the Shell module, but not using it.
You could use it, by doing this:
use Shell qw( perl ); . . . perl "/Users/james/perlstuff/macc/macc1", $file;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Passing user input to a shell command
by james734 (Initiate) on May 17, 2007 at 22:06 UTC | |
by jdporter (Paladin) on May 17, 2007 at 22:18 UTC | |
| |
|
Re^2: Passing user input to a shell command
by adrianh (Chancellor) on May 20, 2007 at 16:21 UTC | |
by jdporter (Paladin) on May 20, 2007 at 18:57 UTC |