Perl's Functional Functions

This video is in English.
Length: 25:19
Source: Salt Lake Perl Mongers on the 2013-06-11.
Speaker: David Oswald speaker

David Oswald's presentation, aimed at newer Perl Monger attendees, discusses Perl built-ins map, grep, and sort as well as examples from List::Util and List::MoreUtils.

The Salt Lake Perl Mongers group, recently revived, currently meets the second Tuesday of each month in space provided by Bluehost.

The talk is especially fun as it is directed to someone fairly new to to Perl who was present at this meeting. Slides are also available.

The common core functional functions

  • grep - filters a list using filtering subroutine
  • map - creates or transforms a list
  • sort - sort a list

From List::Util (core module)

  • first - Like grep, but returns the first one found
  • reduce - Summarizes a list

List::MoreUtils (on CPAN)

  • any - Return true if any element in the list matches
  • all - Return true if all elements match
  • pairwise - Transform two lists, pairwise, into one
  • part - Partitions one list to a bunch of smaller lists
  • natatime - Iterates over a list fetching n element in every iteration