Perl does not provide any special syntax for class definitions Perl 不提供任何特殊的语法对于类的定义 A package is simply a namespace containing variables and subroutines. The only difference is that in a class, the subroutines may expect a reference to an object or…
<pre name="code" class="python">[root@wx03 wx]# cat x1.pm package x1; use Data::Dumper; sub new { my $self ={}; ##引用 my $invocant = shift; my $class = ref($invocant) || $invocant; print "\$class is $class\n"; bless($sel…