You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
522 B
Perl

# Module: House.pm
#!/bin/perl
package House;
sub new{
my $class = shift;
my ($owner, $salary, $style) = @_;
my $ref={ "Owner"=>$name,
"Price"=>$salary,
"Style"=>$style,
};
return bless($ref, $class);
}
sub display {
my $self = shift;
foreach $key ( @_){
print "$key: $self->{$key}\n";
}
}
1;
# main.pl
#!/bin/perl
use House;
my $house = House->new("A", 2, "House");
$house->display ("Owner", "Style");