On Wed, Jul 25, 2001 at 03:07:16PM -0400, Yacketta, Ronald wrote:
> We have a script that is continuously run and sleeps every 30 seconds b4
> grabbing data and populating arrays. Is it possible to make a clean() that
> will wipe the slate clean at the end or beginning of the next run?

There is the solution suggested by Bob Showalter, clearing the values
manually.  The ideal solution would be to use lexical variables that go out
of scope before it starts another iteration.

As a simple example, consider some code that iterates over a list of files,
opening each and processing each line of the file.

    foreach my $file (@files) {
        open(FILE, $file) || die("open \"$file\": $!");

        my @counter;
        while (<FILE>) {
            # do something to fill @counter
        }

        close(FILE);
    }

Because @counter is lexical to the foreach block it's cleared on each
iteration of the foreach.


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

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

Reply via email to