Re: minor problem in summary

"John J. Trammell" <[email protected]>
Newsgroups gmane.comp.lang.perl.qotw.discuss
Message-ID <[email protected]>
On Sat, Sep 11, 2004 at 03:29:23PM -0600, Andrew Dalke wrote:
> I was reading through
> 
>   Sample solutions and discussion
>   Perl Quiz of The Week #23 (20040901)
> 
> and saw
> 
> """
> The results for the Perl code are:
>   ...
>   dalke.py                B N L U
>   ...
> The results for the non-Perl code are:
> 
>   dalke.py                skip
> """
> 
> How did that come about?  Since there are timings for my
> program, I'll assume that it did run,  and I know it
> wasn't in Perl.  :)
> 

Wow, tracking down exactly what happened here has been a learning
experience for me.

At first, I couldn't get it to run, probably because I was running it
without any command-line options.  The error message is:

    File "dalke.py", line 10
      yield ")" * open_count
              ^
  SyntaxError: invalid syntax

I think I saw this once and gave up on your solution.  This may have
been just after I installed a Haskell compiler.  :^)  So where did the
BNLU and the timing data come from?

The answer: at one point I was working with a file named 'unskipped',
listing the scripts I was able to run.  I neglected to remove dalke.py
from this file.  This tidbit (new to me) from perlrun tells the rest:

  If the #! line does not contain the word "perl", the program named
  after the #! is executed instead of the Perl interpreter.  This is
  slightly bizarre, but it helps people on machines that don't do #!,
  because they can tell a program that their SHELL is /usr/bin/perl, and
  Perl will then dispatch the program to the correct interpreter for
  them.

So my testing script invoked dalke.py with /usr/bin/perl, and perl knew
to use the python interpreter to run your script.  Amazing!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.