Hidden features of Perl?

Posted by Adam Bellaire on Stack Overflow See other posts from Stack Overflow or by Adam Bellaire
Published on 2008-10-02T11:49:22Z Indexed on 2010/03/19 17:01 UTC
Read the original article Hit count: 336

Filed under:

What are some really useful but esoteric language features in Perl that you've actually been able to employ to do useful work?


  • Try to limit answers to the Perl core and not CPAN
  • Please give an example and a short description

Hidden Features also found in other languages' Hidden Features:

(These are all from Corion's answer)

  • C#
    • Duff's Device
    • Portability and Standardness
    • Quotes for whitespace delimited lists and strings
    • Aliasable namespaces
  • Java
    • Static Initalizers
  • JavaScript
    • Functions are First Class citizens
    • Block scope and closure
    • Calling methods and accessors indirectly through a variable
  • Ruby
    • Defining methods through code
  • PHP
    • Pervasive online documentation
    • Magic methods
    • Symbolic references
  • Python
    • One line value swapping
    • Ability to replace even core functions with your own functionality

Other Hidden Features:


Quoting constructs:

Syntax and Names:

Modules, Pragmas, and command-line options:


Loops and flow control:

Regular expressions:

Other features:

Other tricks, and meta-answers:

See Also:

© Stack Overflow or respective owner

Related posts about perl

Related posts about Tips