in reply to Re^2: Query on Perl system command
in thread Query on Perl system command
Have you also tried without the -e option? Not all echos require that option, and in the other thread it looks like your echo doesn't.
Another approach would be to do away with system, echo, quoting issues, etc. and use open to open a pipe to phylip, into which you then just print the required input, including newlines. For example:
open my $pipe, "| phylip" or die $!;
print $pipe <<"EOI";
A positive side effect is that the sequence of things you have to enter becomes much better to read.
(Note that the heredoc, as shown, is interpolating $filename (like a double-quoted string). )