in reply to if elsif else not working
G'day parksbanyon,
Welcome to the monastery.
"The first two (exe and txt/ini) find the correct sub's but the else (ie any other file type) is not, its going to the text sub. I tried a multitude of options and rearrangememts prior to posting, but to no avail. I'm stumped."
The string "txt" is TRUE. A zero-length string is FALSE; all other strings are TRUE. [Update: Oops! '0' is also false.] See "perlsyn: Truth and Falsehood".
The expression ($TARX eq "ini" || "txt") will always be TRUE, which is why the else block is never reached.
I see two posts showing how to fix this.
-- Ken
|
|---|