title: How do I create a Perl class?
body: <p>I am writing Perl classes to remove redundancies from scripts and since Perl has a lot of ways to make classes I keep having trouble making the classes properly. So does anyone have a best practice example of a class?</p>
  
  <p>The biggest question I have is if there should be no global variables in a module how do you use variables across sub() in a module? Like Java  self->foo = 10; </p>
  
  <p>Basically just give me a class written in  Java or C# or even C++ and write the same in Perl. Also extra points for showing how to do private, protected and public class variables properly. Inheritance and interfaces would be helpful to I guess. </p>