in reply to Re: I just want IF, OR, OR not every one
in thread I just want IF, OR, OR not every one
I'm trying to test to see if bgs is in the file.if it is not. I add the here document $bgs above syslogd.
But, if it is there. It adds the $here document anyway.
Perhaps the OP wanted to test if $line does NOT contain the literal string 'bgs' and was what he really meant to write $line !~ /bgs/ rather than $line =~ /!bgs/
Then of course his first test falls through (although he thinks erroneously that it succeeds) and to his utter confusion the other conditions in the elsif chain get tested until one succeeds. Hence his question about how the if -- elsif -- else construct works and how to avoid multiple results in this chain to apply, which got us all confused as only one condition can succesfully apply.
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: I just want IF, OR, OR not every one
by wcj75019 (Acolyte) on Feb 29, 2008 at 20:18 UTC | |
by CountZero (Bishop) on Feb 29, 2008 at 21:41 UTC |