On 7/6/05, Chris Devers <[EMAIL PROTECTED]> wrote:
> On Wed, 6 Jul 2005, madhurima das wrote:
> 
> > Kindly tell the pseudocode to solve the following
> > problem:
> >
> >   An user input is provided to a perl program by
> > STDIN. This input is utilised by a fortran program to
> > perform some function. How do i connect both the
> > programs & get the output from the fortran program to
> > the user via the perl program itself.
> >    Waiting for an early response. thanking you...
> 
> Here's some pseudocode:
> 
>      $response = get_user_input();
>      $result   = have_fortran_work_on( $response );
>      $finish   = tell_user_about( $result );
>          # maybe or maybe not do anything with $finish
> 
> For the Fortran bit I've stubbed into have_fortran_work_on(), the usual
> way to do this, short of an Inline::Fortran module on CPAN (there
> doesn't seem to be one, though there are ones like Inline::C, etc), is
> to make a system() call to the external program.
> 
>      <http://perldoc.perl.org/functions/system.html>
> 
> Try using a system() call in your own pseudocode for
> have_fortran_work_on().
> 
> If you're stuck, ask more specific questions, and show what you've tried
> so far.
> 
> 
> 
> --
> Chris Devers

system() probably won't do what you want: it's value it the return
value of the wait system call, not the output of the external program.
If you want to capture the output directly (as opposed to, say,
writing to a file and then parsing the file in Perl) you'll want to
use backticks or qx//. See 'perldoc -f system' or '`STRING`' or
'qx/STRING/' in perlop for more info.

HTH

-- jay
--------------------------------------------------
This email and attachment(s): [  ] blogable; [ x ] ask first; [  ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com  http://www.dpguru.com  http://www.engatiki.org

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to