News for hackers. Stuff that matters.
Re:John Carmack: “I just dumped the C++ server I wrote for a... by Sanddancer on Tuesday March 17, 2015 @11:30PM (#9223441)
For loops in perl have two styles. The first is the c-style loop, the other is a map. One often uses the latter style a lot more often.
Re:John Carmack: “I just dumped the C++ server I wrote for a... by pyre on Wednesday March 18, 2015 @03:40AM (#9224117)
That, and Perl has an actual `map` function too:

  map { $_ + 1 } (@list);
Re:John Carmack: “I just dumped the C++ server I wrote for a... by huehue on Wednesday March 18, 2015 @06:00AM (#9224456)
Sometimes Perl can be a beauty:

  sub sum_of_squared_pairs {
    reduce { $a + $b } map { $_ * $_ } grep { $_ % 2 == 0 } @_
  }

  sub schwartzian_transform {
    map  { $_->[0] }
    sort { $a->[1] <=> $b->[1] } # use numeric comparison
    map  { [$_, length $_] }     # calculate the length of the string
         @_
  }
Re:John Carmack: “I just dumped the C++ server I wrote for a... by eru on Wednesday March 18, 2015 @11:03PM (#9229999)
Yes, but _ has dynamic scope (I believe). That's very dangerous in general.