try !-e instead of -!e. You need to negate the result of the -e operator. By
putting a ! in the middle of the -e operator, perl no longer knows what it
is.
-----Original Message-----
From: Maynard, Garth [mailto:[EMAIL PROTECTED]]
Sent: 14 June 2001 17:05
To: [EMAIL PROTECTED]
Subject: Help with File Exists
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
--------------------------Confidentiality--------------------------.
This E-mail is confidential. It should not be read, copied, disclosed or
used by any person other than the intended recipient. Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful. If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.