|Welcome to the Monastery|
Variable assignment after logical ORby rq-2102 (Acolyte)
|on Oct 02, 2007 at 18:40 UTC||Need Help??|
rq-2102 has asked for the wisdom of the Perl Monks concerning the following question:
I've been having a bit of trouble with getting perl to act reliably following a logical OR statement in code. I want to perform multiple operations in case of a failure when opening a file for write, and so my choices would seem to be to call a subroutine or to set a flag indicating a failure. For example:
open FILE, ">test.txt" || $failed_flag = 1;
The above example will not compile, I've also tried with using a &subroutine instead of a direct assignment with no luck. It compiles, but the subroutine seems to never actually run...