I am iterating through a long hash list, and I want to be able to pause the
script. To do this, I have put a while (-!e $go) loop inside of the while
(keys (%hash)) loop, but the script is looking for $go within %hash, rather
than the predefined location. The error I am getting is:

"Can't call method "e" without a package or object reference at filename.pl
line 81, <LIST> line 4.

How do I get the $go loop to look where I told it?

use Sys::Hostname; 

$host = hostname();
$ip = &IP($host);
$go = "\\\\server\\share\\go\.script";
$ChipFile2 = "\\\\server\\share\\listfile.txt";

open LIST, "< $ChipFile2" || die "$ChipFile2 cannot find file to open $!;
$^E";

# Read the list
%list = ();
while (<LIST>) {
        ($server, $parent) = split;
        $list{$server} = $parent;
}

foreach $server (keys %list){


        while (-!e $go) {
                # In order to pause the script during times of network
congestion, the script looks for
                # a file
                sleep 5;
        }
                
        if ($parent eq $host | $ip){

                # ...do other stuff
                }       
        }
}

Thanks,

Garth

Reply via email to