in reply to Query on Perl system command
I bet your phylip program asks the uses to type the first filename, reads the name in, asks for the second filename, etc.
Instead, make the program read the command line arguments it is invoked with, after which you can run it as
system( '/path/to/phylip', "$filename.txt", "$filename.xls" );
You COULD have the program name and arguments all as one string, but then the shell is invoked to interpret things. With an array of args to system(), the program is invoked wthout involving the shell. That means you don't have to worry about the possibility of $filename having the value ';rm -rf'.
As Occam said: Entia non sunt multiplicanda praeter necessitatem.
|
|---|