Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I always quote the key left of an `=>'. It's because I had bad experiences with earlier perl version with CGI.pm, where things like $q->popup_menu(-values=>[...]) would give a warning and it took a long time for me to figure out that `values' is a perl function. :)

I think the way I figure things out, and it's a bit cargo-cultish; if I can't find what's causing the problem but I found something that stops the problem, then in the back of my mind I avoid doing whatever caused the problem. It sometimes comes back to bite you though, because you didn't take the time to figure out WHY there was a problem; or otherwise, you will end up spending lots of time and energy approaching a problem a certain way just because you try to avoid the "dangerous" method. So, like you say, you have these little superstitions. Then later you might accidentally discover the real cause, and those are happy moments of revelation. AHA!

I thought of another example of mine. I single-quote as much as I can, in the back of my mind thinking that maybe I'm saving a few cycles by not interpolating a double-quoted string. :)

I also always use qq{} for writing SQL or HTML strings. The reason for `qq' is often there are embedded quotes in HTML, and I forget to change the outside quotes. The reason for `{}' is in SQL there are often parentheses. I try to find the most general quotation for all cases to be consistent.

Also I tend to overuse CODE tags in perlmonks. ;)


In reply to Re: Coding superstitions by kwoff
in thread Coding superstitions by George_Sherston

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 pondering the Monastery: (4)
As of 2024-04-18 22:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found