How many time have you been working on some code and wanted to comment out a section of it to test specific code components?
Often.
q{
...;
...;
};
Perl will optimize this away, so there's no execution speed involved. Probably the best thing about this is that many color highlighting editors will mark this as a string (which it is), so you can see that it's something not-normal. BEGIN blocks are not BEGIN blocks anymore, they are just part of the never-executed string. It doesn't do any syntax checking (well, you do have to balance your {}'s, or have to choose other delimiters).
Update (Aug 15 2002):
15:07 <@kane_> juerd: it looks elegant, but wanrs =)
15:07 <@Juerd> kane_: I know, but it's perfect for development code. T
+he
warning is a good reminder, too
15:08 <@Juerd> I can't believe I didn't say anything about warnings in
+ that
post...
15:12 <@Juerd> kane_: Hmmm... use Acme::Comment qw/start q{ end };/ wo
+uld work,
wouldn't it? :)
- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.
-
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.
|