Um... so if you edit the script so that $mode is set to something other than "running", the loop will execute just once, and the script exits; but if you edit the script so that $mode is set to "running", the script loops indefinitely until you kill it (^C or whatever). And that's the intended design?
I would have expected that either (a) the value assigned to $mode would depend on @ARGV (or %ENV, or some other external input), or (b) there would be something inside the loop that could change the value of $mode, or else (c) each time you edit the script to change its behavior, rather than editing a variable assignment, you would just edit the loop condition -- e.g. do {...} while(0); vs. do {...} while(1);, or something to that effect. (Note that the former "do" block will execute exactly once, whereas the block in while(0){...} never executes.)
As it is, I tend to share muba's puzzlement.
(updated to fix spelling)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.