in reply to The FizzBuzz Thing :(

Two concerns:
  1. map is usually used to transform one list into another. What purpose does the @fizzbuzz array serve here? A for-loop would have been more idiomatic, as the returned list is unimportant. In the for-loop, I'd rather use ifs instead of the ternary operators: again, the ternary operator is usually used inside an expression when the returned value is important.
  2. You don't benefit from the fact you can just test for 3 and 5 once, i.e. you're breaking the DRY (don't repeat yourself) principle. There's no need to test for fizzbuzz, you've covered the case in fizz and buzz already.

For comparison, see my solution to a similar task in the Contest Coding competition.

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: The FizzBuzz Thing :(
by Anonymous Monk on Dec 25, 2015 at 21:30 UTC

    DRY? Hmm. I see superfluous variables, print statements in your solution. How about this:

    for (1 .. 100) { say "Fizz" x !($_ % 3) . "Buzz" x !($_ % 5) . "Bizz" x /3/ . "Fuzz" x /5/ || $_ }

      The main point of similar interview questions is (or should be) to provoke discussion. Is it a good practice to use zero time repetition, or negation of a modulo as a number? Etc. There's no "100% right" solution to the question.
      ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,