Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: Query on Perl system command

by Eliya (Vicar)
on Mar 04, 2011 at 15:48 UTC ( #891477=note: print w/ replies, xml ) Need Help??


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"; 4 6 3 5 1 $filename.fsmi 5 $filename.phb 111 1000 4 $filename.ph $filename.dst x EOI close $pipe;

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). )


Comment on Re^3: Query on Perl system command
Select or Download Code
Re^4: Query on Perl system command
by Anonymous Monk on Mar 04, 2011 at 18:35 UTC
    Thank you Eliya :-)

    Yes, you are right, open command is much easier to read and it works perfectly well.

    Chak

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://891477]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2014-12-29 14:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (188 votes), past polls