Perl-Sensitive Sunglasses PerlMonks

### Comment on

 Need Help??
Here are mine,

Update : since I didn't understand anyone elses (give or take) I've added explanations to mine

The first is obvious (51 chars)
The second is stated in a couple different ways (43 chars, 50 chars obfu'd)

```sub obvious{
#  (explained : count from zero until Z, return the current count if w
+e found the position we are looking for)
#        1         2         3         4         5         6
#23456789012345678901234567890123456789012345678901234567890
\$n=pop;for(;\$n ne((0..9),(A..Z))[\$a];\$a++){}"\$a"||0;
}
This one is more fun, it uses bitwise arithmatic to get the solution. The commented line is the same as the first, but more obfu
```sub fun {
# (explained : reduce the numbers to their base2 (binary)
# representation.  we always care about the
# lowest four bits (\$n & 0x1111 is \$n & 15).  If the ord of
# the number is in the A-Z range the 7th bit will be set
# (\$n >> 6) will be true.  In this case, also include the
# 6th bit in the number (\$n & 31) instead of (\$n & 15).
# Since A-Z starts at ten, add 9 as well)
#        1         2         3         4         5         6
#23456789012345678901234567890123456789012345678901234567890
\$n=ord(pop);\$a=(\$n>>6)?((\$n&31)+9):(\$n&15);
# same thing, but obfu
# \$n=ord(pop);\$a=(\$n&(1<<(4+(\$n>>6)))-1)+(\$n>>6&&9);
}

Enjoy, or not, at your leisure.

-jackdied

PS, posting with mozilla is the biggest pain in the ass ever. It tries to do smart things with wrapping in a text box, and translating spaces and returns for you with some AI that makes posting code hell.

In reply to Re: The Perl Review by jackdied
in thread The Perl Review by Kit

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

• Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
• Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
• Read Where should I post X? if you're not absolutely sure you're posting in the right place.
• Posts may use any of the Perl Monks Approved HTML tags:
a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
• You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
 For: Use: & & < < > > [ [ ] ]
• Link using PerlMonks shortcuts! What shortcuts can I use for linking?

Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2018-02-21 04:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
When it is dark outside I am happiest to see ...

Results (274 votes). Check out past polls.

Notices?