variable running once

variable running once

am 07.09.2007 17:03:39 von lerameur

Hello

I just wrote a small script. I would like to know if the following is
possible:
I want to have some initial values like a time in the script. This
script is called from crontab every hour. These initial values should
be run only once when the script starts. Is there such a command in
perl ?
I thought of putting theses values in a separate file and when the
perl program starts, fetches those values and when it exist saves the
newest value so when it is called again it continues where it has
left off.

thanks
k

Re: variable running once

am 07.09.2007 17:14:24 von glex_no-spam

lerameur wrote:
> Hello
>
> I just wrote a small script. I would like to know if the following is
> possible:
> I want to have some initial values like a time in the script. This
> script is called from crontab every hour. These initial values should
> be run only once when the script starts. Is there such a command in
> perl ?
> I thought of putting theses values in a separate file and when the
> perl program starts, fetches those values and when it exist saves the
> newest value so when it is called again it continues where it has
> left off.

That's how you'd do it in any language. You have to store the
values somewhere because once the process exits, they're gone.

Re: variable running once

am 07.09.2007 17:23:44 von Paul Lalli

On Sep 7, 11:03 am, lerameur wrote:
> Hello
>
> I just wrote a small script. I would like to know if the following is
> possible:
> I want to have some initial values like a time in the script. This
> script is called from crontab every hour. These initial values should
> be run only once when the script starts. Is there such a command in
> perl ?
> I thought of putting theses values in a separate file and when the
> perl program starts, fetches those values and when it exist saves the
> newest value so when it is called again it continues where it has
> left off.

Are you looking for the time() function? perldoc -f time.

If not, please post a short-but-complete example of what it is you're
trying to do.

Paul Lalli