in reply to Re^2: unix to perl questions
in thread unix to perl questions
In this particular case, if(defined getpwnam($nUsername)) checks to see whether getpwnam returns a value at all:
- If it finds the user, it will return something and "something" is always defined, so the test evaluates as true.
- If it doesn't find the user, it will return nothing (not just an empty value or a false value, but the absence of a value - in Perl, this not-a-value is called undef, for "undefined"), and the test evaluates as false.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: unix to perl questions
by Anonymous Monk on Mar 12, 2015 at 16:41 UTC | |
|
Re^4: unix to perl questions
by deyaneria (Acolyte) on Mar 12, 2015 at 16:56 UTC | |
by choroba (Cardinal) on Mar 12, 2015 at 16:57 UTC |