in reply to || vs or
If you put the code in test.pl for example, try to run then#!/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";
(have a look on B::Deparse). It shows you how Perl understands the code you've written in each case.perl -MO=Deparse ./test.pl
|
|---|