On Apr 12, Timothy A. DeWees said: >I am trying to execute an external process (in this case dialog). Dialog >displays a menu to the user and will output there selection via stdout or >stderr. I want to take what the system call to dialog will pass to stdout >or stderr and assign it to a string. Here is what I am trying: > >$selection="dialog --backtitle \"$title\" " . > " --clear --menu ". > " \"Main Menu:\" 15 50 8 " . > " \"New\" \"Created a new Virtual account\" " . > " \"Edit\" \"Modify an existing virtual account\" " . > " \"Del\" \"Remove an existing account\" "; > > $tmp = system $selection; > > return $tmp; > >All this does is return the exit status of the program. How can I get it to >return what dialog will pass to stdout?
system() executes a command and returns its exit status, as documented. If you want to capture the process's STDOUT, you'll need to use backticks (``), or open(). $output = `$selection`; $output = qx[$selection]; You can also use an array as the destination of the output, so you'll get individual lines. If you want to get STDERR as well, you'll need to use something like the (standard) IPC::Open3 module. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]