in reply to Variable assignment after logical OR

Try this:

open FILE, ">test.txt" or $failed_flag = 1;