Zentara wrote:
> 
> On Wed, 26 Nov 2003 15:50:57 -0500, [EMAIL PROTECTED] (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.
> 
> Using Inline::Files you can keep the counter in the
> script itself. Run the following a few times and watch
> what happens.
> 
> ###########################################
> #!/usr/bin/perl
> use Inline::Files;
> use warnings;
> use strict;
> 
> open NUMBER, '+<';

You don't need to explicitly open the file handle, Inline::Files does it
for you.  And if you do open it yourself you should _ALWAYS_ verify that
it opened correctly.

> my $number = <NUMBER>;
> seek NUMBER, 0, 0;
> 
> print "I am number $number\n";
> 
> print NUMBER ++$number;
> 
> __NUMBER__
> 0
> 
> __END__



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to