in reply to DDJ Test for Perl

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)

Replies are listed 'Best First'.
Re^2: DDJ Test for Perl
by Argel (Prior) on Aug 22, 2007 at 21:42 UTC
    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.

    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)

        Paraphrasing, there are two possible questions being asked:

        Given an array whose elements do not have any line feeds (or carriage returns, etc.):

        1. How do you print the entire array all on one line?
        2. How do you print each element of the array on a separate line?

        Based on the wording I think the question is actually asking the first question though the author thinks he is asking the second one.