O'Reilly logo

Perl by Example, Fourth Edition by Ellie Quigley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 15. Those Magic Ties and DBM Stuff

Those Magic Ties and DBM Stuff

Tying Variables to a Class

Normally when you perform some operation on a variable, such as assigning, changing, or printing the value of the variable, Perl performs the necessary operations on that variable internally. For example, you don’t need a constructor method just to create a variable and assign a value to it, and you don’t have to create access methods to manipulate the variable. The assignment statement $x=5; doesn’t require any tricky semantics. Perl creates the memory location for $x and puts the value 5 in that location.

It is now possible to bind an ordinary variable to a class and provide methods ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required