My Perl Quiz

The ultimate place to learn Perl!

Question #14: All three ways of calling new() are equivalent in the code below

package A;

sub new {
    my ($class, $param) = @_;
    return bless {param => $param}, $class;
}


package main;

my $a1 = A->new('foo');
my $a2 = new A('foo');
my $a3 = A::new('A', 'foo');