On May 24, Werner Otto said: > system("ping -s localhost 56 1"); > >This will echo: > > 64 bytes from localhost (127.0.0.1): icmp_seq=0. time=0. ms > >How do I get this echo'd value as a string value? I will be splitting this >string up into segments to fill my fields in my database table.
You don't, at least, not with system(). system() doesn't return its output, it returns its exit value. If you want to capture the output of a program, use backticks (``) or the qx() operator. Or consider using open() like so: open PING, "ping -s localhost 56 1 |" or die "can't spawn ping: $!"; while (<PING>) { print "got: $_"; } close PING; As someone mentioned, make sure you tell ping to stop after a certain count, if it doesn't do so automatically. If you don't, then you won't be able to stop it (unless you use the open() method above, and put a 'last' in the while loop somewhere). But have you considered using the Net::Ping module? -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ CPAN ID: PINYAN [Need a programmer? If you like my work, let me know.] <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>