On Mon, Oct 11, 2004 at 10:42:54AM +0700, Beast wrote: > kenapa perl tdk bisa menagkap hasil jika yg diexecute adalah shell > script, bkan command. > > #!/usr/bin/perl > # hasil blank > my $cmd1 = `cmd.sh`; > print "results: $cmd1\n"; > > # hasil ok. > my $cmd2 = `ls /home`; > print "results: $cmd2\n";
Saya rasa bukan masalah script atau command, tapi tergantung outputnya ke mana, stdout? stderr? both? Coba baca 'perldoc perlop' cari string "`STRING`", di situ dikasih contoh utk capture stdout dan stderr sekaligus, yg basically ya seperti di shell: my $result = `cmd 2>&1`; Ronny
pgpLNr4CmpEEr.pgp
Description: PGP signature