The following might help in getting light on the issue:
#!/usr/bin/perl
use strict;
#use warnings;
my ( undef, undef, $uid, $gid ) = getpwnam( 'roo' )
|| warn "Oh no - || and not existent user roo\n";
print "1. UID: $uid, GID: $gid\n\n";
( undef, undef, $uid, $gid ) = getpwnam( 'root' )
|| warn "Oh no - || and existent user root\n";
print "2. UID: $uid, GID: $gid\n\n";
( undef, undef, $uid, $gid ) = getpwnam( 'roo' )
or warn "Oh no - OR and not existent user roo\n";
print "3. UID: $uid, GID: $gid\n\n";
( undef, undef, $uid, $gid ) = getpwnam( 'root' )
or warn "Oh no - OR and existent user root\n";
print "4. UID: $uid, GID: $gid\n\n";
If you put the code in test.pl for example, try to run then
perl -MO=Deparse ./test.pl
(have a look on
B::Deparse). It shows you how Perl understands the code you've written in each case.
Update. It isn't really something guaranteed to work, but I use to imagine '( || )' as opposed to ')or(' to keep in mind the much lower precedence of 'or'. And whenever I'm in doubt, I prefer to place the parens explicitely. It's not something to be ashame of ;)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.