perldoc -u "output of a command" definitely helped.

One more issue I noticed after testing the code was I needed the if
statement enclosed within the first set of braces.

while (<>) {
        $user = `echo $_`;
        $result = `dsquery user -samID $_`;
if (!$result) {
        print "$user\n";
}
}

This is now working how I anticipated. 

Thanks all who replied.

-----Original Message-----
From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 09, 2005 2:05 PM
To: Rob.Savino
Cc: beginners@perl.org
Subject: Re: help with matching

Rob.Savino wrote:
> I'm working on a simple script to get a list of users who do not exist
> 
> while (<>) {
>       $user = system("echo $_");
>       $result = system("dsquery user -samID $_");
> }
> if (!$result) {
>       print "$user\n";
> }
> 
> Here is my problem,
> 
> dsquery user -samID should return nothing if a user does not exist. I
> was hoping the script would print $user only if there was no $result
> from dsquery user -samID. However, not only does it print every $user
> regardless of the was not $result, it also prints every $result.
> 
> Can someone tell me why this is?

perldoc -q "output of a command"

http://danconia.org

> 
> Thanks,
> 
> Rob
> 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to