Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
The "not" that is implicit in "unless" is subtle enough that it can get "lost" when you are looking at code.

I never had that problem. For me, the "not" cannot be lost, because without it it's not unless any more.

This shows that not only shouldn't you use "unless" even for simple conditionals, but shouldn't even consider using "unless".

No, it does not. That's an undue generalization. You may not advocate the banishment of a language construct as a general rule just because "quite a few" got "burned by it now". There's no count of those which never got burned by using 'unless', and which are quite comfortable using it as a statement modifier or a control construct in the sense perlsyn states:

"if" executes the statement once if and only if the condition is true. "unless" is the opposite, it executes the statement unless the condition is true (i.e., if the condition is false).

Subtleties in the english language regarding 'unless' are irrelevant and must not be stressed to daemonize it's use. After all, we're programming perl, not writing english statements.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

In reply to Re^4: Regex Or Die! (!unless) by shmem
in thread Regex Or Die! by pileofrogs

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2024-04-19 12:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found