huguei has asked for the wisdom of the Perl Monks concerning the following question:

Hi!
I just received an update from DDJ new articles in their website, and this issue there is a "Test Your Knowledge of Perl".
Obviously I run through it, but I got two strange questions/answers. I couldn't answer the numbers 41 and 46, and the answers doesn't seem to be ok!. What do you think?
The link: http://www.ddj.com/linux-open-source/201801549

(I don't give here the questions and answers... to not spoil the test ;) )

Replies are listed 'Best First'.
Re: DDJ Test for Perl
by sgt (Deacon) on Aug 22, 2007 at 19:36 UTC

    Interesting, thanks. I think that the test if well dosed overall and that it can tell if someone does not know Perl.

    Still I think that the phrasing of some questions is poor especially 41. 46 is ok. Years ago I trained mayself to read the /s modifier as superdot (a term used by J Friedl in "mastering regular expressions" IIRC) and the /m mod. as multi-line-anchors ;)

    cheers --stephan
      Yes, maybe my english isn't good enough ;(
Re: DDJ Test for Perl
by zentara (Cardinal) on Aug 22, 2007 at 20:01 UTC
    I don't think 41 was written correctly, and I read English fairly well. First none of the given answers work.

    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
Re: DDJ Test for Perl
by suaveant (Parson) on Aug 22, 2007 at 19:40 UTC
    I think 41 is just wrong. You'd need a join or at least something like $,="\n";print @a to do what he is asking

                    - Ant
                    - Some of my best work - (1 2 3)

      Question #41 is poorly worded. For example, in "add them to the end of each entry" what does the "them" refer to -- the values (the array elements) or newlines? I thought the former when I read it but the answer indicates the latter was the intent.

      With that said I believe that English grammar rules would hint at removing the "that do not contain newlines" part of the sentence to determine what the "them" refers to.

      In which case the correct answer would be #1.

      Update: Massive rewrite and added spoiler tags.

        I think that by "each" you have to assume array elements

                        - Ant
                        - Some of my best work - (1 2 3)

Re: DDJ Test for Perl
by Aim9b (Monk) on Aug 23, 2007 at 00:23 UTC
    Thank you for pointing out the perl test. I just read it expecting to answer about 10-20 correctly. Imagine my joy when I correctly answered 42 of them. I guess the books are working for me. The monestary gets a lot of the credit too.
    I got number 41 correct, but I see where one of the monks said it would not work, so I guess I'm confused too. Also, I answered fork instead of system to 25, so I have a little more studying to do in that area. Thanks again.
      system implicitly forks and execs. If you want to "launch a child process to run a program", then fork is half the solution.
        Your bias is showing.
        system implicitly forks and execs.
        On my computer, system does neither of those.
Re: DDJ Test for Perl
by GrandFather (Saint) on Aug 28, 2007 at 04:44 UTC