> In slave perl prog, there're some print codes.
> However, when the master perl calling the slave one by system(command), the
> slave perl print cannot be redirected to STDOUT.
What? That's what it already does by default.
> how to solve that?
Did you mean something like
system("perl my_other_program.pl > /dev/null") and die;
?
--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
I cannot reproduce your problem:
C:\tmp>type master.pl
use strict; use warnings;
system 'slave.pl';
C:\tmp>type slave.pl
use strict; use warnings;
print "Slave here\n";
C:\tmp>master.pl
Slave here
Obviously the slave program prints to STDOUT just fine.
Please provide a minimal program that demonstrates your problem.
jue
Oh sorry the perl is called by a master SHELL master.sh but not master
perl...
#!/bin/sh
`perl slave.pl $dirname`
So how to solve?
> #!/bin/sh
> `perl slave.pl $dirname`
> So how to solve?
Don't use backticks. See man sh.
--
Lars Eighner <http://larseighner.com/> use...@larseighner.com
Countdown: 261 days to go.
Send the output stream from your Perl program to STDOUT:
#!/bin/sh
echo `perl slave.pl $dirname`
--
Jim Gibson
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
http://www.usenet.com
> Send the output stream from your Perl program to STDOUT:
>
> #!/bin/sh
> echo `perl slave.pl $dirname`
or, you know:
#!/bin/sh
perl slave.pl $dirname
>#!/bin/sh
> `perl slave.pl $dirname`
Dude, you are _EXPLICITELY_ asking the shell to capture the output of
the subprocess and you wonder why it isn't printed?
> So how to solve?
Maybe don't ask the shell to caputure the output?
jue
Ouch!
hp
>>
>> #!/bin/sh
>> `perl slave.pl $dirname`
JG> Send the output stream from your Perl program to STDOUT:
JG> #!/bin/sh
JG> echo `perl slave.pl $dirname`
useless use of echo. just drop the backticks as others have mentioned.
uri
--
Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------