Perlのオブジェクト
Sample.pm
package Sample; sub new { my $class = shift; bless {}, $class; } 1;
sample.pl
#!/usr/bin/perl use Sample; my $obj = (); # NG $obj = Sample::new; # OK $obj = Sample::new('Sample'); $obj = Sample->new;
Sample.pm
package Sample; sub new { my $class = shift; bless {}, $class; } 1;
sample.pl
#!/usr/bin/perl use Sample; my $obj = (); # NG $obj = Sample::new; # OK $obj = Sample::new('Sample'); $obj = Sample->new;