Monks,
I was perusing Meditations, as I am wont to do on a Friday afternoon. I stumbled upon Don’t Repeat Your… version number. It's probably because my brain is already off for the weekend, but I can't seem to wrap my head around the code:
my %const = map { s/\s+//; $_ }
map { split /\s*=>\s*/ }
grep { /=>/ }
map { split /\n/ } << '=cut';
=pod
This module uses the following constants:
bang_eth => 1
biff => 2
krunch => 3
=cut
I don't do a lot of POD, so I'm pretty lost. I can discern that the code is parsing something that looks like the POD at the end, grabbing the key/value pairs and putting them into a hash. Can anyone shed some (step-by-stepish) light on this?
Strange things are afoot at the Circle-K.
-
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.
|