Weekly Perl Script [Issue 7]

Bill Jones bill at fccj.org
Fri Jul 23 07:50:42 CDT 1999


On the Jax.PM jacksonville-pm-list;
"Bill Jones" <bill at fccj.org> wrote -


> On the Jax.PM jacksonville-pm-list;
> j proctor <jproctor at oit.umass.edu> wrote -
> Okay, no one has answered in a week.  I guess I'll stab at it.
>
>
>>  while (++$len <= length) {
>>       print substr($_, $len, 1)
>>           if (index("abcdefghijklmnopqrstuvwxyz",
>>                      substr($_ , $len, 1)) > -1);
>>   }
>
>
> print split(/[^a-z]+/, $_);
>
>
> For the second (bonus) question, what's so 'funny' about the script, I
> have no idea.  The bits where he strips white-space aren't necessary, but
> I don't feel like running benchmarks to see if they actually hurt
> performance.  It's at least slightly amusing that sneex put the effort
> into playing with this when the whole thing could by handled by that tr///
> I wrote a couple paragraphs above, and that I was duped into playing with
> it also.  I did use map for the very first time, so it wasn't a total
> loss. :)
>
> Um, I can't think of anything else.  What, pray tell, was so 'funny'?
>
>
> j


Very good :)  When you moving back to Jax, FL ???

I haven't tested your code as a replacement (on my way to a meeting)
but I will answer the second portion of your post first:

The BONUS is also misleading - the script does nothing more funny
than simply ignore any data lines that start with a Capital letter.

So, you get credit for being first to answer and you get credit for
answering the BONUS without really knowing - your solution - on
the surface without testing - appears to do the same thing as the
code you've replaced.

Yes, all that other stuff was supposed to be misleading; functional,
but misleading none the less.

I'll have a better answer about the puzzle/question/answer and why latter.


Thx,
-Sneex-  :]

(Where is my other shoe?)


The Jacksonville Perl Monger's Group is operated by -
Bill -Sneex- Jones ( sneex at usa.net ),
to whom send all praises, complaints, or comments...




More information about the Jacksonville-pm mailing list