Skip to Content
Higher-Order Perl
book

Higher-Order Perl

by Mark Jason Dominus
March 2005
Intermediate to advanced
600 pages
14h
English
Morgan Kaufmann
Content preview from Higher-Order Perl

CHAPTER 2 DISPATCH TABLES

In Chapter 1, we saw how to make functions more flexible by parametrizing their behaviors in terms of other functions. For example, instead of hardwiring the hanoi() function to print a certain message every time it wanted to move a disk, we had it call a secondary function that was passed in from outside. By supplying an appropriate secondary function, we could make hanoi() print out a list of instructions, or check its own moves, or generate a graphic display, without recoding the basic algorithm. Similarly, we were able to abstract the directory-walking behavior away from the file-size-computing behavior of our total_size() function to get a more useful and generally applicable dir_walk() function that could be used ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Perl

Beginning Perl

Curtis Ovid Poe
Think Perl 6

Think Perl 6

Laurent Rosenfeld, Allen B. Downey
Minimal Perl

Minimal Perl

Tim Maher
Perl by Example

Perl by Example

Ellie Quigley

Publisher Resources

ISBN: 9781558607019