Yoiu are doing an assignment vs a check. Also when doing checking the numeric 
checks are ==, > , <  but for the type of chck you want , use eq (ie if ( $z eq $a ) { 
# do something}

        The  ' if ( $z = $a )' catches most at least once.

Wags ;)

-----Original Message-----
From: nir cohen [mailto:[EMAIL PROTECTED]]
Sent: Saturday, November 24, 2001 09:56
To: [EMAIL PROTECTED]
Subject: rpoblem with open two files in a script


Hello All
I try to write a script that open 2 files .
the first file is /etc/passwd which in the first column has the
users name in my server .the second file is a file that has just users name in each 
row.
I want a script that will check both files and if the users name is the same in the 
two files the script will print me the whole line from /etc/passwd for this user.
Here is what I did-the problem is that it print me the whole users of /etc/passwd even 
those users that are not in the other file.
here is the script:
#!/usr/bin/perl -W
open(nir, '/etc/passwd');
while(<nir>) {
($a, $b, $c, $d, $e, $f, $g, $h) = split(/:/, $_);
open(zvi, '/users/zvikaus/Rad_pine.txt');
$z=<zvi>;
chomp($z);
if ($z=$a) {
print ("$a\n");
#print ("$a,$b,$c\n");
}
close(zvi);
}
close(nir);


   thanks in advance 

                                                          Nir

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

Reply via email to