O'Reilly Open Source Convention
oreilly.comO'Reilly Network
Conferences International Safari: Books Online


Arrow Home
Arrow Registration
Arrow Speakers
Arrow Keynotes
Arrow Tutorials
Arrow Sessions
Arrow At-a-Glance
Arrow BOFs
Arrow Events
Arrow Exhibitors
Arrow Sponsors
Arrow Hotel/Travel
Arrow Venue Map
Arrow See & Do
Arrow Press
Arrow Mail List
Kids World


From the Frontiers of Research to the Heart of the Enterprise
O'Reilly Open Source Convention
Sheraton San Diego Hotel and Marina
July 22-26, 2002 -- San Diego, CA


Apache

Tutorial

Mastering Data Structures and References in Perl
Paul Grassie, Tom Christiansen Perl Consultancy

Track: Perl
Date: Monday, July 22
Time: 8:45am - 12:15pm
Location: Grande Ballroom A

Proper use of Perl's data structures and references is one of the main ways of "Doing More with Less" in Perl. Examples presented in this tutorial cover a wide range of crucial techniques in Perl including the use of anonymous arrays and hashes, multidimensional data structures, autovivification, anonymous subroutines and closures. In addition, the important role played by references in object oriented Perl will be introduced.

TUTORIAL OUTLINE:

  • Introduction
    • What are references and why are they useful?
    • What kinds of data structures does Perl support?
    • Using a hash as a data structure
  • Syntax of References
    • Creating references
    • Dereferencing references
    • An array of references
    • Checking your references
    • Anonymous arrays and hashes
    • Multidimensional arrays and hashes
    • Complex data structures
  • Applying Data Structures and References
    • Printing data structures using Data::Dumper
    • Saving and restoring data structures using Data::Dumper
    • Building data structures on the fly
      • Creating an array of anonymous hashes
      • Faster sorting using the Schwartzian Transform
    • Autovivifying arrays, hashes, and filehandles
    • Creating multi-valued hashes using autovivification
  • Creating the Right Data Structure for the Job
    • Example: reporting cities by state
    • Example: reversing the mapping of a hash
    • Using references as objects
    • Example of a hash-based object
    • Example of an array-based object
  • References and Subroutines
    • Controlling the scope of data structures
    • Passing arrays, hashes and filehandles to subroutines
    • Returning references to private variables
    • Creating subroutine references
    • Anonymous subroutines
    • Callback subroutines
    • Closures
  • References and Object Oriented Perl
    • Blessing objects
    • Using references as objects
    • Example of a hash-based object
    • Example of an array-based object



oreilly.com Home | O'Reilly Bookstores | How to Order | O'Reilly Contacts
International | About O'Reilly | Affiliated Companies | Privacy Policy


© 2001, O'Reilly Media, Inc.
conf-webmaster@oreilly.com