query



Sir,

I have the following problem:

I need a perl program which asks the user to input
two numbers x & y. The program next calls a fortran
program to do some calculations with the two numbers x
& y & sends the output z back to the perl program. The
perl program next conveys this output z to the user.

My programming approach to this problem is as
follows:


####PERL PROGRAM####

#assign.pl#

#!/usr/bin/perl

use strict;
use warnings;

print "enter the first number\n";
my $x = <STDIN>;
chomp $x;

print "enter the second number\n";
my $y = <STDIN>;
chomp $y;

my @z = system("assign.f",'$x','$y');

print "Output of the two numbers is:\n";
print @z,"\n";

exit;

#output of assign.pl#
>$ perl assign
enter the first number
2
enter the second number
4
Can't exec "assign.f": Permission denied at assign
line 14, <STDIN> line 2.
Output of the two numbers is:
-1

------------------------------------------------------------

####FORTRAN PROGRAM####

#assign.f#

WRITE(*,*) "ENTER FIRST NUMBER"
READ(*,*) x
WRITE(*,*) "ENTER SECOND NUMBER"
READ(*,*) y
z = x+y
WRITE(*,*)"OUTPUT OF THE TWO NUMBERS IS:"
WRITE(*,*)z
END


#output of assign.f#
>$ g77 assign.f
>$ ./a.out
ENTER FIRST NUMBER
2
ENTER SECOND NUMBER
4
OUTPUT OF THE TWO NUMBERS IS:
6.


So,i'm unable to connect both the programs. Kindly
help with some books or pseudocode or the functions
needed to solve this problem.
Waiting for an early response. Thanking you..





__________________________________________________________
How much free photo storage do you get? Store your friends 'n family snaps for FREE with Yahoo! Photos http://in.photos.yahoo.com
.



Relevant Pages

  • perl security question
    ... I have a C wraper program that has a setgid turned on. ... The perl program will exec another program based upon the $ARGV. ... exec $cmd, 'arg1', 'arg2'; ...
    (comp.lang.perl.misc)
  • Re: Shell Commands (Getting PID and Timing Them)
    ... The exec() function causes your computer to stop executing the perl program and execute the other program instead. ... A single process won't do both, but a parent process and a child process can. ...
    (comp.lang.perl.misc)
  • Re: how to run dos command in perl
    ... Start An External Program Running From Within A Perl Program ... If the "exec" version of the run command is used then the external ...
    (perl.beginners)
  • Re: perl security question
    ... > I have a C wraper program that has a setgid turned on. ... > The C wraper will call proper perl program with correct gid. ... Why not simply exec the right program in the first place? ... As this program is called from a setid C program, ...
    (comp.lang.perl.misc)
  • Re: Ordering large files (in perl?)
    ... >> I guess it isn't only that exec() only ... your Perl program has been replaced by the sort program. ... > It isn't really a Perl issue, it is an issue with the Unix process model. ... fork() then; but I'm not certain I won't be. ...
    (comp.lang.perl.misc)