I'd say the idea is not too complicated -- for every + you increase the ascii code, for every - you decrease it. In between, at every non-space character, you print the character corresponding to it. Or something like that, fact is it took me about 2 minutes to figure this out, and I think it's because the main body of the program is obvious (the for through each character loop).
How about the following suggestions to `improving the non-readability of your code':
- Use special Perl variables ($/ $= $,)
- Avoid overusing obvious keywords (eval, split), go for regexps if possible
- When using regexps, feel free to use characters other than forward slashes
- When quoting strings, feel free to use other quoting techniques (qq[])
I made a few superficial changes based on what I said, but I don't have Perl here, so I'll hope you at least get the idea if it doesn't run. Oh and I don't mean to offend if you already knew these things.
$==109;for(split//,q{
/
++++++
++o-------=++ ++
++_--------------<+
++,+++++++++ +/
-------- --
-/ {
){m?\s??():s:-|+:$=$&$&:?eval:print chr($=)}
-
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.
|