home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 37.4 Why Learn Perl? #2 Chapter 37
Perl, a Pathologically Eclectic Rubbish Lister
Next: VI. Managing Processes

37.5 And Now, Perl 5

[This article was adapted from the Perl 5 manual pages. -JP]

Other articles in this chapter were actually written for the previous version, Perl 4, but they apply to Perl 5 as well. Perl 5 is nearly a complete rewrite of Perl 4. Most Perl 4 scripts will work under Perl 5. Perl 5 has these new benefits (and more):

  • Many usability enhancements : It is now possible to write much more readable Perl code (even within regular expressions). Error messages are more informative; the optional warnings will catch many of the mistakes a novice might make.

  • Lexical scoping : Perl variables may now be declared within a lexical scope, like "auto" variables in C.

  • Arbitrarily nested data structures : Any scalar value, including any array element, may now contain a reference to any other variable or subroutine.

  • Modularity and reusability : The Perl library is now defined in terms of modules that can be easily shared among various packages. A package may choose to import all or a portion of a module's published interface. Pragmas (that is, compiler directives) are defined and used by the same mechanism.

  • Object-oriented programming : A Perl package can function as a class. Dynamic multiple inheritance and virtual methods are supported in a straightforward manner and with very little new syntax. Filehandles may now be treated as objects.

  • Embeddable and extensible : Perl may now be embedded easily in your C or C++ application, and can either call or be called by your routines through a documented interface. The XS preprocessor is provided to make it easy to glue your C or C++ routines into Perl. Dynamic loading of modules is supported.

  • POSIX compliant : A major new module is the POSIX module, which provides access to all available POSIX routines and definitions, via object classes where appropriate.

  • Package constructors and destructors : The new BEGIN and END blocks provide means to capture control as a package is being compiled, and after the program exits. They work just like awk 's BEGIN and END when you use the -p or -n switches.

  • Multiple simultaneous DBM implementations : A Perl program may now access DBM, NDBM, SDBM, GDBM, and Berkeley DB database files from the same script simultaneously.

  • Regular expression enhancements : If you thought Perl 4 regular expressions were rich and full of incredible features, wait until you see Perl 5!

- JP

Previous: 37.4 Why Learn Perl? #2 UNIX Power Tools Next: VI. Managing Processes
37.4 Why Learn Perl? #2 Book Index VI. Managing Processes

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System