On Wednesday, Nov 26, 2003, at 12:50 US/Pacific, Amit Phatak wrote:
I have a fortran program calling a perl script for various parsing activities for multiple number of times. I wish to increment a variable by 1 in the PERL SCRIPT (not the fortran program) to have a record of how many times the script has been called. In simple words, i have a variable $count in the perl script.. I wisth to $count++ everytime the script is called by the fortran program.[..]
you will forgive me, my fortran is rusty, but why do you want the fix in the Perl rather than in the Fortran?
A part of the problem you face is persisting the count value between invocations. You might think in terms of a TIE trick here. { cf perldoc Tie::Hash } especially IF you want to keep track of how many times the code is called by a given process.
The perl script would then need to see who had invoked it, get their process ID, and keep track of it that way. This way if more than one instance of your fortran code were running, then each of them would be able to have their own counter.
The alternative of course would be to have the 'perl code' start up as a daemon that handled requests on a socket, this way you would save the 'start up' overhead of invoking a new process each time through.
ciao drieux
---
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]