Skip to content

Instantly share code, notes, and snippets.

@Lochlan
Last active August 15, 2017 05:51
Show Gist options
  • Save Lochlan/18287b135301529951966d9587b2004b to your computer and use it in GitHub Desktop.
Save Lochlan/18287b135301529951966d9587b2004b to your computer and use it in GitHub Desktop.

Perl Complaints of the Day

  1. Only lambdas can be closures, not named subroutines.

  2. The idiomatic way of getting a list’s length is to assign it to a scalar.

    my @coolList = (1, 2, 3);
    my $coolListLength = @coolList;
  3. There is no boolean data type in Perl; 0, '0', '', (), and undef are falsy and all other values are truthy. This makes it very hard to represent true or false alongside those other data types. The JSON::XS library handles this awkwardness with references: \0 and \1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment