$amode = do {
if ($f & O_RDONLY) { "r" } # XXX: isn't this 0?
elsif ($f & O_WRONLY) { ($f & O_APPEND) ? "a" : "w" }
elsif ($f & O_RDWR) {
if ($f & O_CREAT) { "w+" }
else { ($f & O_APPEND) ? "a+" : "r+" }
}
};
|
< Learn to Switch with for Switch with for via && and || > Table of Contents | Page 25 |
YAPC 19101,
June 2001 Perl Idioms Nathan Torkington |